Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting the submit button value using jsp

Tags:

html

jsp

submit

Dear All, I have a form with multi submit buttons like this

<FORM NAME="form1" METHOD="POST" Action="SomePage.jsp">
        <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Button 1">

        <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Button 2">

        <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Button 3">
    </FORM>

How can i get the submit value using JSP ?

like image 292
hind Avatar asked Nov 24 '10 07:11

hind


People also ask

How can get submit button value in JSP?

It's just by its name available as request parameter as well. String submit = request. getParameter("submit");

Can a submit button have a value?

Value. An <input type="submit"> element's value attribute contains a string which is displayed as the button's label. Buttons do not have a true value otherwise.

How is the value attribute of a submit button used?

Definition and Usage The value attribute specifies the initial value for a <button> in an HTML form. Note: In a form, the button and its value is only submitted if the button itself was used to submit the form.


1 Answers

It's just by its name available as request parameter as well.

String submit = request.getParameter("submit");

See also:

  • Hidden features of HTML

That said, a JSP is the wrong place to postprocess a form submit. Use a Servlet.

like image 185
BalusC Avatar answered Oct 07 '22 17:10

BalusC