Actually i want to use the textbox value and set the session parameter in the same JSP page without submitting it or like using request or response object. This textbox value i want to use in the same JSP page for further use. How can i access the value of a text box in the same page?
Asked
Active
Viewed 3,857 times
1 Answers
1
You could either utilize the new HTML5 local storage (only supported in the more recent/modern browsers), or you could create a session cookie in JavaScript and store the value in there.
Note that none of those approaches will affect the server side HttpSession
in any way. For that you simply can't go around sending a HTTP request containing the desired information, as that's the only way to send information from the client to server side. You could however consider using ajax to send the HTTP request asynchronously and fully transparently in the background.

BalusC
- 1,082,665
- 372
- 3,610
- 3,555
-
@Blausc i am completely new to this....i even dont know AJAX ....if you could guide me by giving any link for that AJAX how can i send request?.. i wll be thnkful to u....plzzz – Harshil Shah Sep 24 '12 at 19:15
-
1Well, that's a pretty broad question. Minimum prerequirement is a moderate understanding of how basic HTTP, HTML and JavaScript work. If you already don't have a moderate grasp on them, then stop developing for a moment and invest time in learning those basic concepts. After that, look at those answers for some basic Servlet+Ajax examples: http://stackoverflow.com/a/4113258 and http://stackoverflow.com/a/4115298 The only difference is basically that you don't need to change the HTML DOM tree after retrieving the ajax response (that is, when you don't want to have any visual feedback). – BalusC Sep 24 '12 at 19:19