strut2验证失败隐藏字段值丢失
我正在使用 strut-2.1.6
我有一个视图页面,其中包含隐藏字段中当前查看的记录的主键。 如果我发布此页面来保存记录,并且任何验证都会失败。 我回到同一页面,它保留所有其他值,但丢失隐藏字段值。 现在,当尝试保存它时,我在请求参数中得到主键值 null。
对此的任何帮助将非常感激。
i am using strut-2.1.6
I have a view page wich contains the Primary key of the currently viewed record in a hidden field. If i post this page to Save the record and any validation gets faild. i come back on the same page it keeps all other values but lose the hidden field value. Now when try to save it i get null for the primary key value in request parameters.
any help on this will highly be oblighed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在执行验证的操作中,您是否同时拥有此隐藏值的 getter 和 setter?
如果是这样,您应该能够在那里设置断点,并确保隐藏值既被推入您的操作,又被拉出。
如果您使用 Preparable,操作中的此 id 是否有可能在验证方法或准备方法中被破坏?
最初调用以呈现此页面的操作是否与用于验证的操作相同?
Do you have both a getter and a setter for this hidden value in your action that performs the validation?
If so, you should be able to set breakpoints in there and make sure the hidden value is both getting pushed into your action, and pulled back out.
Is there any chance this id in the action is getting destroyed either in the validation method, or prepare method if you're using Preparable?
Is the action that gets called to render this page initially the same one that is used for validation?