You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oscar <os...@gmail.com> on 2010/06/28 18:47:16 UTC

Escape html characters on Struts 2.1.8

Hi to all, i have a little problem with Struts 2 <s:select> tag. I'm
building a HashMap List that feeds the select tag, but the problem is
that HashMap elements contains characters like Ñ, á, é and so on and
when i submit the form that contains the list, in the second jsp where
i print the value of s:select selected option, it shows me something
like this (In my example the option value is DAÑADO):

DAÑADO

So i decided to encode character to corresponding html entities before
create the HashMap List, to do that i used StringEscapeUtils from
apache commons lang. It does it very well because in the case of
"DAÑADO" it gives me "DA&Ntilde;ADO" but the problem is, that when
s:select internally prints the <option>s , it prints
"DA&amp;Ntilde;ADO" , i see that encode the & to it's corresponding
html entity and i don't want that, so i don't know if is possible to
tell <s:select> tag to escape html like other tags, like this:

<s:property value="#request.something" escape="false" />

Or if somebody knows another solution?

Thanks and regards.

-- 
Oscar Calderón
SCJP 6
http://www.javahowto.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org