Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JSF-使用ajax调用更改panelGroup-bean、EL和?_Java_Jsf_Jsf 2_Facelets_Javabeans - Fatal编程技术网

Java JSF-使用ajax调用更改panelGroup-bean、EL和?

Java JSF-使用ajax调用更改panelGroup-bean、EL和?,java,jsf,jsf-2,facelets,javabeans,Java,Jsf,Jsf 2,Facelets,Javabeans,我必须对一些panelGroupUI进行某种切换。 关于视图部分,我做了如下操作: <h:panelGroup layout="block" id="profile_content"> <h:panelGroup layout="block" styleClass="content_title"> Profilo Utente </h:panelGroup> <h:panelGroup rendered="#{s

我必须对一些
panelGroup
UI进行某种切换。 关于视图部分,我做了如下操作:

<h:panelGroup layout="block" id="profile_content">
    <h:panelGroup layout="block" styleClass="content_title">
        Profilo Utente
    </h:panelGroup>

    <h:panelGroup rendered="#{selector.profile_page=='main'}">
        <ui:include src="/profile/profile_main.xhtml" />
    </h:panelGroup>

    <h:panelGroup rendered="#{selector.profile_page=='edit'}">
        <ui:include src="/profile/profile_edit.xhtml" />
    </h:panelGroup>

    <h:panelGroup rendered="#{selector.profile_page=='insert'}">
        <ui:include src="/profile/profile_articles.xhtml" />
    </h:panelGroup>
</h:panelGroup>
因此,现在我的问题是:当我使用一些
h:commandButton
更改“上下文”时,我希望使用对服务器的异步调用。这是我的按钮面板:

<h:commandButton value="EDIT">
    <f:ajax event="action" execute="???" render=":profile_content"/>
</h:commandButton>

<h:commandButton value="PM">
    <f:ajax event="action" execute="???" render=":profile_content"/>
</h:commandButton>

<h:commandButton value="ARTICLES">
    <f:ajax event="action" execute="???" render=":profile_content"/>
</h:commandButton>

我不知道在
execute
上放什么,因此我编辑bean值,并使用
render=“:profile\u content”

希望这个问题是可以理解的。请原谅我的语言:)

干杯

使用。您不需要覆盖默认的“执行”
execute
属性(即
@this
,唯一的按钮)

例如



请注意,该案例在_分数以下。我建议将
profilePage
修改为
profilePage
。这是Java,不是PHP。

感谢您对CamelCase的建议。是的,这很有效。我觉得奇怪的是,如果我删除,它会向服务器发出一个正常的请求(页面被重新加载)。否则,如果我添加,前面的ActionListener将以异步方式工作。奇怪的行为,我需要了解为什么会发生这种情况:)这就是
f:ajax
的全部要点。将其更改为异步(ajaxical)提交。您真是JSF的专家!!正如我多次说过的,再次感谢你,伙计!我认为你应该得到1-10杯啤酒:)为什么你有一个冒号:在profile\u内容之前,即不应该没有冒号,我也在后面,但我不需要冒号。冒号将抛出一个错误,id::profile\u内容找不到。不用说,他们已经对答案和结论进行了投票。如果你能欢呼,请回复。@Shahzeb:OP就是这么用的。当组件不在同一表单中时,它是必需的。如果您有问题,只需按
Ask question
按钮即可。
<h:commandButton value="EDIT">
    <f:ajax event="action" execute="???" render=":profile_content"/>
</h:commandButton>

<h:commandButton value="PM">
    <f:ajax event="action" execute="???" render=":profile_content"/>
</h:commandButton>

<h:commandButton value="ARTICLES">
    <f:ajax event="action" execute="???" render=":profile_content"/>
</h:commandButton>
<h:commandButton value="EDIT">
    <f:setPropertyActionListener target="#{selector.profile_page}" value="edit" />
    <f:ajax event="action" render=":profile_content"/>
</h:commandButton>