Hi!

 

I was trying to submit a html form which has a <html:file> tag and others 
<html:text> and <html:textarea> tags. I have specified 
âmultipart/form-dataâ to the parameter enctype in <html:form> and I have 
set character-encoding in all JSP pages through the following tag: 

 

ï<%@ page

  language="java" 

  pageEncoding="UTF-8" 

  contentType="text/html;charset=utf-8" %>

 

I have override the method handleRequest() in a subclass of 
org.apache.struts.upload.CommonsMultipartRequestHandler

 

and I have put the following tag in struts-config file:

 

<controller

  contentType="text/html;charset=utf-8" 

  locale="true" 

  nocache="true"

  multipartClass="br.com.agenciaclick.struts.MyMultiPartClassHandler"/>

 

but it was not enough, because the following conflict: If the enctype of form 
is set to "multipart/form-data", the file submmited are well parsed and 
received by the server, but the text fields have not their own enctype. Thus 
the enctype found to each text field are "null" and the method 
"addTextParameter()" inside 
"org.apache.struts.upload.CommonsMultipartRequestHandler" class treat them as 
"ISO-8859-1", like this line of code:

 

value = item.getString("ISO-8859-1");

 

It would better if the information configured through <controller> tag in 
struts-config file was passed as parameter through the methods until here, and 
then the line of code above should use the character encoding specified by the 
programmer.

 

I have implemented this solution in my project and it has working well.

 

Thanks for this opportunity

 

Lauriberto MÃximo Alves

System Analist and System Engineer

AgenciaClick BrasÃlia - Brazil

E-mail: [EMAIL PROTECTED] 

Phone Number       : +55 (61)  424-5800

Work FAX Number    : +55 (61)  424-5820

Mobile Phone Number: +55 (61) 9974-3514

Reply via email to