仅渲染页面的一部分 [英] Rendering only a fragment of the page
本文介绍了仅渲染页面的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要实现一个Web应用程序,该Web应用程序的顶部带有一个菜单(标签视图),其中每个选项卡都呈现内容区域而不呈现整个页面.我该如何以模块化的方式做到这一点? 我希望每个内容区域都是一个流程.
I need to implement a web application with a Menu (Tab View) on top where each tab renders the content area without rendering the whole page. How can I do it in a modular way? I want each content area to be a flow.
推荐答案
您可以尝试以下操作:
<h:form id="topMenu">
<f:ajax render="content">
<h:commandLink actionListener="#{mrBean.openPage('About.xhtml')}" value="About Us" />
<h:commandLink actionListener="#{mrBean.openPage('Contact.xhtml')}" value="Contact Us" />
</f:ajax>
</h:form>
<h:panelGroup id="content">
<ui:include src="#{mrBean.page}" />
</h:panelGroup>
这是您的ManagedBean:
And this is your ManagedBean:
@ManagedBean
@RequestScoped
public class MrBean {
private String page;
public void openPage(String page) {
this.page = page;
}
}
这篇关于仅渲染页面的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文