| | |
Form data
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2007
Posts: 34
Reputation:
Solved Threads: 0
I have a Form input field in my JSP:
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?
JSP Syntax (Toggle Plain Text)
<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:JSP Syntax (Toggle Plain Text)
<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?
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.
Check out my New Bike at my Public Profile at the "About Me" tab
![]() |
Similar Threads
- Need help with RSS feeds and importing form data (PHP)
- Form data & Back button (PHP)
- MDI Child Form Placement (C#)
- E-mail form data quick and easily with PHP (PHP)
- get posted form data in python (Python)
- form validation not working (JavaScript / DHTML / AJAX)
- Form not sending email (PHP)
- Posting form data to an Oracle database (JavaScript / DHTML / AJAX)
Other Threads in the JSP Forum
- Previous Thread: retrieving values from jsp page
- Next Thread: help me
| Thread Tools | Search this Thread |
apache array backbutton combobox comma connection csv database development directorystructure dropdownlist dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 mysql netbeans network parameters passing ping printinserverinsteadofclient project read redirect request.getparameter response seperated servlet servletdopost()readxml sessions software sql ssl state_saving_method stocks sun tomcat tutorial update values video web write






