Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Encoding problem with File Upload

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I'm using enctype="multipart/form-data" in the html:form tag, the Upload Page has many fields other than the file path field, whenever I use the Upload JSP page , the data in the other fields became rubbish(NON English Characters) , because of the enctype="multipart/form-data" in the form tag, should I make the upload thing in a pop menu so I don't use enctype in the JSP page, or there is a solution to my problem??

Thanks in advance
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you will use org.apache.struts.upload.FormFile as the type for the uploaded file in your ActionForm bean, you can have any number of other fields of other types, and Struts should populate them correctly.

For an example of this, see the upload example in the struts-examples.war file that comes with the Struts download.
 
Rabee' Nawash
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm already using org.apache.struts.upload.FormFile but the problem is with non-english characters , the characters became rubbish
 
Rabee' Nawash
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the solution to my problem, it seems its a bug reported in struts, the solution is to override the proccess method in the RequestProcessor class as following :

public void process(
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
try {
request.setCharacterEncoding("utf-8");
} catch (Exception ex) {

}
super.process(request, response);
}

the bug was reported in the following link:
http://issues.apache.org/bugzilla/long_list.cgi?buglist=29668
[ April 12, 2006: Message edited by: Rabee' Nawash ]
 
No, tomorrow we rule the world! With this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!