Hi,
I wish to save value entered by user in textbox in a session variable.my form contains many elements and i need to navigate back and forth.so i want to save the value once entered by the user in a session variable so that i can retrieve it and display on navigating back.i know session.setAttribute("varname",stringvalue);
saves stringvalue in varname but how do i get textbox value as a string on the page and save it there?request.getParameter does not work on the same page.
Thanks
Ankita B
2
Light Poster
Recommended Answers
Jump to Posthi there have you tried this:
<%session.setAttribute("[I]varname[/I]", request.getParameter([I]Textboxname[/I]));%>
Jump to Postrequest.getParameter works just fine. You shouldn't use it of course as you should NEVER use any Java code on a JSP, but it does work.
Jump to PostI am quite new to JSP JWenting, I am intrigued, why is java code on JSP frowned upon?
All 10 Replies
majestic0110
187
Nearly a Posting Virtuoso
jwenting
1,889
duckman
Team Colleague
majestic0110
187
Nearly a Posting Virtuoso
jwenting
1,889
duckman
Team Colleague
majestic0110
187
Nearly a Posting Virtuoso
Ankita B
2
Light Poster
jwenting
1,889
duckman
Team Colleague
Ankita B
2
Light Poster
sumit_indian
-4
Newbie Poster
peter_budo
commented:
JSP is for presentation, servlet is for logic. Servlet is where you should setup connection with DB!
-1
jwenting
1,889
duckman
Team Colleague
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.