struts2 property tag show un-normal value
struts 2.0.9
The value is
AÜC
jsp
obj.value = "<s:property value='customer.name'/>"
obj represents an input field.
However, this input field value displayed as
[code]A& #xDC;C[/code]
AÜC is got from DB and it is correct in struts action. Meanwhile if I just assign “AÜC” to obj.value in jsp, it also can show right string.
Therefore the problem is from .
I tried to add escapeHtml=’false’ to “<s:property value=’customer.name’ />”, but the jsp throws an exception and stop running.
Eventually,
I found that if we put
[code]<s:property value=’customer.name’ />[/code]
in element value attribute, e.g.
[code]<input value="<s:property value=’customer.name’ />" />[/code]
,
then it’s normal.
But if we use it in js, for example,
[code]
<script>
obj.value = "<s:property value=’customer.name’ />";
</script>
[/code]
then it will show in-normal value, in this case we need to use jstl
[code]
<script>
obj.value = ${customer.name}";
</script>
[/code]