Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Escaping special characters in hidden fields

843835Apr 1 2003 — edited Apr 2 2003
I 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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2003
Added on Apr 1 2003
7 comments
1,199 views