Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试JSF在页面加载后使用特定的默认值预先填充输入组件。我怎样才能做到这一点?
JSF
我正在设置所有输入字段的提交值,但它不起作用,也许视图尚未初始化。我读到了阶段监听器,但我不知道我可以在哪里做这些。
顺便说一句,我使用 Seam Entity Home 来绑定每个输入组件的值。
例子:
<h:inputText value="#{entityHome.instance.name}" />
像这样的东西。
有没有人知道如何在 JSF 1.2 中做到这一点?谢谢。:))
尝试
<f:metadata> <f:event listener="#{backBean.method()}" type="preRenderView"/> <f:metadata>
在你的方法()中应该有检索数据的逻辑并将其设置在 entityHome.instance 中。
根据您的要求,类型可以是 preRenderView 或 preRenderComponent,甚至<f:metadata>在某些情况下也不需要包装器,它也取决于您要如何调用方法的要求。
<f:metadata>