gpt4 book ai didi

jsf-2 - 为什么 id is not found when I access through tag?

转载 作者:行者123 更新时间:2023-12-02 22:02:25 24 4
gpt4 key购买 nike

 <h:panelGroup id="userPanel"><f:subview rendered="#{searchView.isUser}">
<h:commandButton value="test" action="#{searchAction.doFindUsers}" >
<f:ajax execute="@this" event="action" render="userPanel" />
</h:commandButton> </f:subview></h:panelGroup>

我得到的错误是:无法在组件 j_idt26 的上下文中找到它

最佳答案

因为 <f:subview> NamingContainer .

另见:


只需使用 <h:panelGroup> ,

<h:panelGroup id="userPanel">
<h:panelGroup rendered="#{searchView.isUser}">
<h:commandButton value="test" action="#{searchAction.doFindUsers}">
<f:ajax execute="@this" event="action" render="userPanel" />
</h:commandButton>
</h:panelGroup>
</h:panelGroup>

<ui:fragment> (只有一点点开销)

<h:panelGroup id="userPanel">
<ui:fragment rendered="#{searchView.isUser}">
<h:commandButton value="test" action="#{searchAction.doFindUsers}">
<f:ajax execute="@this" event="action" render="userPanel" />
</h:commandButton>
</ui:fragment>
</h:panelGroup>

或者在这个具体的例子中直接在命令按钮上(当然你的情况比这更复杂)

<h:panelGroup id="userPanel">
<h:commandButton value="test" action="#{searchAction.doFindUsers}" rendered="#{searchView.isUser}">
<f:ajax execute="@this" event="action" render="userPanel" />
</h:commandButton>
</h:panelGroup>

另见:

关于jsf-2 - 为什么 <h :panelGroup> id is not found when I access through <f:subview> tag?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16670720/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com