Is it possible to do smth like this:
<button type="submit" name="Remove" value=<% request.setAttribute("status", "removed")%> >Remove</button><br />
Will the button value workout this way?
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, it won’t work that way. Java/JSP runs in the webserver and generates HTML which the webserver sends to webbrowser. Rightclick page in webbrowser and do View Source. You see, there’s no single line of Java/JSP code.
The
valueattribute should represent the button’s value which is to be sent as request parameter value. If you actually want to check in the next view (as definied in<form action>URL of the form associated with this button), then you should just check the presence of the button’snamein the request parameter map.(here
Removeis thenameof the button, I’d rather lowercase it by the way)Alternatively, you can set the attribute in the servlet which the form is submitting to:
and then check it in the forwarded JSP as follows: