h:inputText, h:selectOneMenu 在重新渲染后显示旧值

发布于 2024-11-19 08:22:41 字数 482 浏览 10 评论 0原文

我在表的每一行都有 h:inputText, h:selectOneMenu 。我在每行的末尾还有删除按钮。单击删除按钮相应行被删除。当我删除一行时,表中显示的行数减少一,但数据仍然显示旧行。考虑以下示例:

考虑我有三行:

Text1 comexBox1 delete1
Text2 组合框2 删除2
Text3comboxBox3delete3

单击delete1:

当前行为
Text1 组合框1 删除2
Text3comboxBox3delete3

预期行为
Text2 组合框2 删除2
Text3comboxBox3delete3

我观察到的一件奇怪的事情是,当我将inputText更改为outputText时,数据正在刷新。我仅在使用输入组件(textArea、testBox、组合框和复选框)时遇到此问题。

我在门户环境中使用JSF1.2、Spring web-flow。

I have h:inputText, h:selectOneMenu in every row in a table. I also have delete button at the end of each row. On-click of delete button corresponding row is deleted. When I delete a row, number of rows displayed in the table is reduced by one but the data is still displayed from old row. Condider the following example:

Consider I have three rows:

Text1 comboxBox1 delete1
Text2 comboxBox2 delete2
Text3 comboxBox3 delete3

on-click of delete1:

Current behaviour
Text1 comboxBox1 delete2
Text3 comboxBox3 delete3

Expected behaviour
Text2 comboxBox2 delete2
Text3 comboxBox3 delete3

One weird thing that I observed is that, when I changed inputText to outputText the data is getting refreshed. I am facing this problem only with input components (textArea, testBox, combo-box and check-box).

I am using JSF1.2, Spring web-flow in portal environment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

柠檬色的秋千 2024-11-26 08:22:41

因此,仅显示输入组件的提交值,而不显示模型值。这表明特定组件上的验证失败。您究竟如何调用删除按钮?我的印象是您正在抑制验证错误并删除非操作方法内的行。

这不是删除数据表行的正确方法。您所需要的只是删除按钮上的 immediate="true" (并确保同一行的输入组件上没有此属性!)。

So, only the submitted value of the input component is been shown instead of the model value. This suggests that validation has failed on the particular component. How exactly are you invoking the delete button? I have the impression that you're suppressing validation errors and removing the row inside a non-action method.

This is not the proper way of deleting a datatable's row. All you need is an immediate="true" on the delete button (and ensure that you don't have this attribute on the input components of the same row!).

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