Is it possible to use request.setAttribute on a JSP page and then on HTML Submit get the same request attribute in the Servlet?
Is it possible to use request.setAttribute on a JSP page and then on HTML
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. Unfortunately the Request object is only available until the page finishes loading – once it’s complete, you’ll lose all values in it unless they’ve been stored somewhere.
If you want to persist attributes through requests you need to either:
<input type='hidden' name='myhiddenvalue' value='<%= request.getParameter('value') %>' />. This will then be available in the servlet as a request parameter.request.getSession()– in a JSP this is available as simplysession)I recommend using the Session as it’s easier to manage.