3
我必须做一些panelGroup
用户界面的切换。 关于视图部分,我做了这个:JSF - 通过使用ajax调用改变panelGroup - Bean,EL和?
<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>
现在,修改这个值,我写了一个专属的JavaBean,被称为选择:
@ManagedBean(name="selector")
@RequestScoped
public class Selector {
@ManagedProperty(value="#{param.profile_page}")
private String profile_page;
public String getProfile_page() {
if(profile_page==null || profile_page.trim().isEmpty()) {
this.profile_page="main";
}
return profile_page;
}
public void setProfile_page(String profile_page) { this.profile_page=profile_page; }
}
所以,现在成功了我的问题:当我通过使用一些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
,使我编辑的豆类价值,我用render=":profile_content"
希望这个问题是难以理解的更改上下文。请原谅我对语言:)
干杯
感谢您对CamelCase的建议。是的,这是有效的。我觉得奇怪的是,如果我删除,它会向服务器发出正常的请求(页面被重新加载)。否则,如果我添加,则以前的ActionListener将以异步方式工作。奇怪的行为,我需要了解为什么会发生这种情况:) –
markzzz
2010-11-25 21:31:52