is it possible to set a session attribute using JSTL from a hidden input in the jsp page?
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.
You can use
<c:set>to set an attribute in an arbitrary scope and you can use${param}to access a request parameter.This will basically do
session.setAttribute("foo", request.getParameter("foo"));during rendering of the response of the JSP result page with this line where the form is been submitted to. In this example, the hidden field should have the namefoo.If you actually need to set it before forwarding the request/response to the JSP, then you’ll need to do this (indirectly) in the responsible controlling/postprocessing servlet class where the form is been submitted to.
If you actually need to set it during displaying the form, then just set the value directly using
<c:set>instead of passing from a hidden input. E.g.