You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Billy Ng <kw...@earthlink.net> on 2003/05/08 23:24:35 UTC
URLDecode.decoder question
Hi folks,
If I use HttpSerlvetRequest.getParameter() to get a value, the value will be decoded right. However, if I use Struts' form.getWhateve() method, the value is not decoded. Is Struts using the getParameter to get the form value behind the scene?
I ask this because I just want to make sure I won't double decode the values.
Billy Ng
RE: URLDecode.decoder question
Posted by Erez Efrati <er...@netmedia.net.il>.
Hi Billy,
What you could do is write your own BaseForm.java and in the reset()
method
Include the following:
Public void Reset (...) {
Super.reset (mapping, request);
Try {
// setting the character encoding here is very important
// to overcome the problem regarding to the Tomcat server.
request.setCharacterEncoding("UTF-8");
}
catch (UnsupportedEncodingException ex) {
}
}
That should do it, as it works just fine in my project.
Hope this helps,
-- Erez Efrati
-----Original Message-----
From: Billy Ng [mailto:kwokng@earthlink.net]
Sent: Thursday, May 08, 2003 11:25 PM
To: Struts Users Mailing List
Subject: URLDecode.decoder question
Hi folks,
If I use HttpSerlvetRequest.getParameter() to get a value, the value
will be decoded right. However, if I use Struts' form.getWhateve()
method, the value is not decoded. Is Struts using the getParameter to
get the form value behind the scene?
I ask this because I just want to make sure I won't double decode the
values.
Billy Ng
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org