S
Soefara
Dear Sirs,
I have been using the O'Reilly com.oreilly.servlet.MultipartFilter
filter to parse uploaded files in JSP and servlets. This in itself
works fine and I have had no problems with it.
I have also been using Tomcat's SetCharacterEncodingFilter filter to
set the character set of all requests to UTF-8, so that I can handle
multiple languages. This also works fine in normal FORM submissions
using GET and POST.
However, I have just noticed that any fields submitted in a form which
uses enctype="multipart/form-data" are not converted to UTF-8,
regardless of the order in which I do the filtering.
A simple solution would be to use one form
(enctype="multipart/form-data") for uploading files and a different
form for setting fields. However, it would be better to let users
update fields and upload files in the same form. Is there any way to
enable this ?
The Mutlipart Upload filter is described here
http://www.servlets.com/soapbox/filters.html
Specifically, I added the library, and then added this to web.xml
<filter>
<filter-name>multipartFilter</filter-name>
<filter-class>com.oreilly.servlet.MultipartFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>multipartFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
I also have this in web.xml (as mentioned,it doesn't matter what order
I do the filter-mapping, it doesn't help)
<filter>
<filter-name>SetCharacterEncodingFilter</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Both filters work independently. But the setCharacterEncodingFilter is
not having any effect for enctype="multipart/form-data" type forms.
Has anybody solved similar problems ?
Thank you very much in advance,
Soefara
I have been using the O'Reilly com.oreilly.servlet.MultipartFilter
filter to parse uploaded files in JSP and servlets. This in itself
works fine and I have had no problems with it.
I have also been using Tomcat's SetCharacterEncodingFilter filter to
set the character set of all requests to UTF-8, so that I can handle
multiple languages. This also works fine in normal FORM submissions
using GET and POST.
However, I have just noticed that any fields submitted in a form which
uses enctype="multipart/form-data" are not converted to UTF-8,
regardless of the order in which I do the filtering.
A simple solution would be to use one form
(enctype="multipart/form-data") for uploading files and a different
form for setting fields. However, it would be better to let users
update fields and upload files in the same form. Is there any way to
enable this ?
The Mutlipart Upload filter is described here
http://www.servlets.com/soapbox/filters.html
Specifically, I added the library, and then added this to web.xml
<filter>
<filter-name>multipartFilter</filter-name>
<filter-class>com.oreilly.servlet.MultipartFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>multipartFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
I also have this in web.xml (as mentioned,it doesn't matter what order
I do the filter-mapping, it doesn't help)
<filter>
<filter-name>SetCharacterEncodingFilter</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Both filters work independently. But the setCharacterEncodingFilter is
not having any effect for enctype="multipart/form-data" type forms.
Has anybody solved similar problems ?
Thank you very much in advance,
Soefara