Html 使用jsp获取提交按钮值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4264436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:25:57  来源:igfitidea点击:

getting the submit button value using jsp

htmljspsubmit

提问by hind

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 ?

如何使用 JSP 获取提交值?

回答by BalusC

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

它也可以作为请求参数使用它的名称。

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

See also:

也可以看看:



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

也就是说,JSP 是对表单提交进行后处理的错误位置。使用Servlet