I have a Form input field in my JSP:

<input name="nickname"  type="text" value="<%= NameClass.getInfo() %>" />

How do I make sure this data is escaped correctly to be able to show quotes and apostrophes. I tried slash in front (name=\"nickname\") and it didnt work.

I dont have JSF,Struts, JSTL, StringEscapeUtils (from Apache commons) due to restrictions on my Tomcat 4.1.27 container.

Is there something I can use or please advise best way to handle this?

I have a Form input field in my JSP:

<input name="nickname"  type="text" value="<%= NameClass.getInfo() %>" />

How do I make sure this data is escaped correctly to be able to show quotes and apostrophes. I tried slash in front (name=\"nickname\") and it didnt work.

I dont have JSF,Struts, JSTL, StringEscapeUtils (from Apache commons) due to restrictions on my Tomcat 4.1.27 container.

Is there something I can use or please advise best way to handle this?

What do you mean escape correctly?
Plus you don't display the 'nickname'. That is the name of the element. Like the variable name of a JTextField in swing.
The real value is the 'value' attribute and you display whatever the NameClass.getInfo() returns.
You use the 'nickname' when you submit the form:

String nicknameValue = request.getParameter("nickname")

It will have whatever the field has. And when the page loads the initial value that will be displayed is the NameClass.getInfo().

If you want apostrophes at the field then (I think this is correct but try it anyway) have the NameClass.getInfo() return this:
"a value"
and do this:
<input name="nickname" type="text" value='<%= NameClass.getInfo() %>' />

And for better responses try the jsp forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.