Do you have add a CharacterEncodingFilter in web.xml ?
for example

<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

On Sun, Dec 28, 2008 at 10:54 AM, jmlynn <jmlynn...@gmail.com> wrote:

>
> Hi, I am new to handling Simplified Chinese text in Struts, JSP, Java web
> site. I was able to read from database, and disply Simplified Chinese text
> in my JSP pages.
> However, when I modified the displayed Chinese text in my JSP and submit
> it,
> What I got in the Action class was unreadable text, which was saved to the
> database.
>
> To determine what the problem was, I added a java line of code to hardcode
> the returned text:
> String strValue = formBean.getTranslated();
> strValue = "some Chinese text";   // override code for testing
> preparedStmt.setString(1, strValue);
> preparedStmt.execute();
>
> I can now update my database with the hardcoded Chinese text. Hence it is
> obvious that the getTranslated() method did not return properly encoded
> text.
>
> I had been using the following in my JSP pages
> <%...@page contentType="text/html" pageEncoding="UTF-8"%>
> ...
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> ...
> <html:textarea property="translated" rows="4" cols="60"/>
>
> I thought I was encoding the page correctly since I can display and enter
> Chinese text.
>
> Any idea?
> --
> View this message in context:
> http://www.nabble.com/How-do-I-submit-Simplified-Chinese-text-to-my-Action-Class--tp21189721p21189721.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to