strut2验证失败隐藏字段值丢失

发布于 2024-08-01 22:42:42 字数 175 浏览 2 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽清梦 2024-08-08 22:42:42

在执行验证的操作中,您是否同时拥有此隐藏值的 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文