Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法使用 JSP 获取表单元素本身的名称?我搜索了 google 并没有找到任何示例来说明如何获取 JSP 文件中指定的表单值的名称。
例如,我有以下表格,
<html> <form name="register" action="servregister" method="POST" onsubmit="return validate();"> </form> </html>
我想将字符串“注册”到 JSP 中的字符串变量。有没有办法做到这一点?
不,a<form>没有随请求一起提交。而是创建一个hidden包含该信息的输入元素。
<form>
hidden
<input type="hidden" name="name of form" value="value" />
或者可能是submit元素
submit
<input type="submit" name="distinguishing name" value="submit" />
这些中的任何一个都以 url 编码参数的形式发送。
如果您解释您的目标,可能会有更好的解决方案来解决您正在尝试做的事情。
考虑研究实现目标的不同模式。