struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <>
Subject Re: Html-encoding to UTF-8: hidden field vs. other fields?
Date Sun, 21 Sep 2014 08:32:43 GMT
2014-09-20 23:08 GMT+02:00 Heikki Hyyrö <>:
> Hi all,
> I have recently ran into a problem, which at least on the surface seems a bit strange.
First the background. The Struts 2 -based application in question has the following kind of
guard for losing data due to session timeout. If a user tries to submit a form after session
timeout, the application forwards the user to a relogin page. The relogin page forwards (almost)
all parameters that it received to another page that then automatically (using Javascript)
calls the original action by submitting a form with hidden parameters that convey all parameters
that the original form had submitted.
> This works fine except for a strange(?) problem regarding character encoding. If the
submitted form contains special characters, such as &ouml; or &auml;, the final action
receives them in garbled form. I have checked that these characters are still html-encoded
on the forwarding page itself, for example the raw html-code of the last form on the auto-forwarding
page might look like this:
> <form action=”/App/saveText.action" method=post">
>   <input type="hidden" name="text" value="&lt;p&gt;K&ouml;ln&lt;/p&gt;"
>   <input type="submit" value="Forward" />
> </form>
> When this form is submitted, the action saveText receives the parameter ”text” in
garbled (not correct UTF-8) form.
> However, if there is no timeout and I look at the raw html-code of the original form,
the code might look like this:
> <form action=”/App/saveText.action" method="post">
>   <textarea name="text">&lt;p&gt;K&ouml;ln&lt;/p&gt;</textarea>
>   <input type="submit" value="Save" />
> </form>
> When this form is submitted (and there is no session timeout), the action saveText receives
the text as correct UTF-8. The two forms and their contents seem identical except that in
the first case the text is in a hidden field whereas in the latter case it is in a textarea.
Why does the action saveText receive the data garbled in one case and ok in the other? Aren’t
both types of input fields handled in the same way by the Struts 2 framework? How could I
fix this problem?

Missing encoding declaration?

+ 48 606 323 122

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message