[英]Why i can't use request.getParameter in my form
i have a question about using request.getParameter()
, i knew that it can use to post the value using request.getParameter, Is it necessary match request.getParameter
and <input>
??? 我有一个关于使用request.getParameter()
,我知道它可以用来使用request.getParameter发布值,是否有必要将request.getParameter
和<input>
匹配?
My original code in HTML: 我的原始HTML代码:
<INPUT type=submit name="submit" value="download">
In JSP: 在JSP中:
String start = request.getParameter("submit");
Now I want to change a button and use div 现在我想更改一个按钮并使用div
div name="submit"id="submit" class="btnStyleFunc"
onclick="document.body.style.cursor='wait';this.disabled='true';
document.getElementById('form').submit();">
But it doesn't work, anyone can help me ? 但这不起作用,任何人都可以帮助我吗?
Now i use the method below, but another problem is raised...the action does not stop... 现在我使用下面的方法,但是又出现了另一个问题...动作没有停止...
String start = request.getParameter("submit1");
<input type=hidden name=submit1 value=download>
<div class="btnStyleFunc" onclick="document.body.style.cursor='wait';
this.disabled='true';document.getElementById('form').submit();">
Does anyone know what the problem is ? 有谁知道是什么问题?
A clicked submit button is a successful form control and its name/value pair will be submitted to the server in the form data. 单击提交按钮是成功的表单控件,并且其名称/值对将以表单数据提交到服务器。
If you submit a form with JavaScript, there is no clicked submit button, so it won't appear in the data. 如果使用JavaScript提交表单,则不会单击提交按钮,因此它不会显示在数据中。 A div
cannot have a name
and is not a form control anyway — it isn't a submit button, even if it triggers JavaScript that submits the form. div
不能有name
,也不能是表单控件-它不是提交按钮,即使它触发了提交表单的JavaScript。
Using a div with JavaScript also breaks the form for: 将div与JavaScript一起使用还会破坏以下形式:
Use a real submit button instead. 请使用真实的提交按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.