How do I assign hidden value to JSTL variable?
Example:
<input type="hidden" name="userName" value="Administrator" />
<c:set var="user" value="" /> // How do I set hidden variable value (Administrator) here?
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.
I assume that you actually mean: "How do I assign submitted hidden input value to a JSTL variable?", because the question as you currently state makes no sense. You could just copy the value in the tag.
You can access request parameters by the implicit EL object
${param}which can be accessed like aMap.Behind the scenes, this assigns the result of
request.getParameter("userName")to a variable nameuserin the page scope.That said, I question the value of this need. Maybe it’s time to learn a bit more about servlets as page controllers and Javabeans as model objects?
See also: