无法取消复选框值
我可能在这里问了错误的问题。
这是一个 jsp 项目,我正在对其进行一些小的更改。我在页面中添加了一个新的复选框。在选中复选框的情况下保存表单似乎按预期工作;但是,如果未选中该框并提交表单进行保存,则它似乎会忽略该复选框 - 它在刷新时保持选中状态。
我使用firebug发现提交的表单内容确实不包含“mycheckbox=”对。
业务对象似乎是Spring自动构造的,并且它的值是自动填充的,所以我不知道在哪里可以拦截流程并将缺少“mycheckbox”视为取消选中。
有什么指点吗?
编辑:我相信这个项目中也使用了 webflow。
edit2:我违反了星际法则来让它工作,通过在代码中使用字符串并在数据库中使用 varchar(1) ,用“Y”表示 true,“N”表示 false。
I may be asking the wrong questions here.
This is a jsp project that I am making small change to. I added a new checkbox to the page. Saving the form with the checkbox checked seems to be working as expected; however, if the box is unchecked and the form is submitted for saving, it seems to be ignoring the checkbox -- it stays checked upon refresh.
I use firebug and find that the submitted form content indeed does not contain "mycheckbox=" pair.
The business object seems to be automatically constructed by Spring, and its values are automatically filled in, so I don't know where I can intercept the flow and consider the lack of "mycheckbox" as an uncheck.
Any pointers?
edit: i believe webflow is also used in this project.
edit2: I violated inter-galatic law to get it to work, by using a string in code and varchar(1) in the DB, with 'Y' to indicate true, and 'N' to indicate false.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你有两种选择:
1:你使用 Spring 标签:
2:你使用 html
对于第二种选择,Spring 将使用 _check_name 来设置值。
You have two choices :
1: you use Spring tag :
2: you use html
With the second choice, Spring will use the _check_name to set the value.