Html 我想在我们的下一个 jsp 中获取禁用文本框的值,但我得到的是空值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3757806/
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 04:34:30  来源:igfitidea点击:

I want to get the value of disabled text box in our next jsp but i am getting null value

htmljsp

提问by Sanjeev

I want to get the value of disabled text box in our next jsp but I am getting a NULL value. Any idea what might be going wrong?.

我想在我们的下一个 jsp 中获取禁用文本框的值,但我得到了一个 NULL 值。知道可能出了什么问题吗?

回答by Darin Dimitrov

Input fields marked with disabled="disabled"never send their value to the server when the form is posted. You could use the readonly="readonly"attribute in order to still make the field not editable by the user but send the initial value to the server when the form is submitted.

disabled="disabled"当表单发布时,标记为永远不会将其值发送到服务器的输入字段。您可以使用该readonly="readonly"属性使该字段仍不能被用户编辑,但在提交表单时将初始值发送到服务器。

回答by prewin

You can't get disable property value into server side. You need to run javascript to fetch disabled value into servlet.

您无法在服务器端获取禁用属性值。您需要运行 javascript 才能将禁用的值提取到 servlet 中。