如何在 Struts 2 验证框架中验证布尔值
简单:我必须确保选中表单上的隐私复选框。我尝试使用表达式验证器(和字段表达式验证器),但它不起作用。 有人可以帮助我吗?
Simple: I have to be sure the privacy checkbox on my form is checked. I tryed to use the expression validator (and the fieldexpression validator) but it does'n work.
Can anobody help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您能提供更多信息吗?您是如何使用表达式验证器的,为什么它不起作用?看来这种方法应该很好用。
需要考虑一些事情:您的布尔值是否同时具有“getter”和“setter”方法?您的拦截器堆栈中是否同时具有“验证”和“工作流”拦截器(例如“defaultStack”)。
Can you provide more information? How were you using the expression validator, and why didn't it work? Seems like that approach should work fine.
A few things to consider: do you have both a "getter" and a "setter" method for your boolean? Do you have both the "validation" and the "workflow" interceptors in your interceptor stack (the "defaultStack" does, for example).
这对我有用:
This worked for me: