input type=submit 的小问题

以前使用strtus2时,在jsp页面中有input时要去name才可以保证数据不会被提交到服务器,一直没有弄明白为什么会这样的,看到一段解释明白了。

HTML元素 - input type=submit
定义
创建一个按钮,点击该按钮后,即提交表单。
Creates a button that, when clicked, submits the form.
注释
使用 VALUE 标签属性将创建无法由用户编辑的显示标签。默认的文字是 Submit Query。如果用户单击提交按钮提交了表单,并且按钮指定了 name 标签属性,那么该按钮也将以 name/value 方式成对提交。
如果 INPUT type=submit 元素是 FORM 元素的一部分,则该按钮将以粗边框显示,这代表着用户按回车就可提交表单。
如果在同一表单中有多个 INPUT type=submit 按钮,按回车键将使用第一个 INPUT type=submit 按钮提交表单,除非此时正有另一个 INPUT type=submit 按钮获得了焦点。如果另外一个 INPUT type=submit 按钮已获得焦点,按回车键将使用获得焦点的 INPUT type=submit 按钮提交表单。
此元素在 Internet Explorer 3.0 及以上版本的 HTML 和脚本中可用。
此元素是一个内嵌元素。
此元素不需要关闭标签。
Use the VALUE attribute to create a button with a display label that cannot be edited by the user. The default label is Submit Query. If the user clicks the Submit button to submit the form, and that button has a name attribute specified, that button contributes a name/value pair to the submitted data.
If the INPUT type=submit element is part of a FORM element, it appears as a button with a dark border, which indicates the user can press ENTER to submit the form.
When there is more than one INPUT type=submit in the same form, pressing enter submits the form using the first INPUT type=submit, unless another INPUT type=submit has focus. When another INPUT type=submit has focus, pressing enter submits the form using that INPUT type=submit.
The INPUT type=submit element is available in HTML and script as of Internet Explorer 3.0.
This element is an inline element.
This element does not require a closing tag.

你可能感兴趣的:(input type=submit 的小问题)