Escaping special characters in hidden fields
843835Apr 1 2003 — edited Apr 2 2003I am using a hidden field to pass values to the servlet. I am populating the hidden field from a bean. The hidden field can have any string value. My problem is that the value attribute on my hidden field is double quoted and if there is a double quote in the value of the String from my bean it messes my HTML up. Is there an easy workaround for this?
e.g.
<jsp:useBean id="myObject" scope="request" class="MyObject"/>
...
<input type="hidden" name="myValue" value="<%=myObject.getValue()%>">
If myObject.getValue() returns a string: 60" Mower this will mess my HTML up.
Any suggestions?