1
在我的应用程序中,我有导师和学生作为用户角色。我决定两者的主页都是一样的。但是,导师和用户的菜单会有所不同。我制作了.xhtml页面tutorMenu.xhtml和student.xhtml。并且要从角色包含菜单中依赖。对于整个页面,我使用布局,并在每个页面更改内容“内容部分”在UI:组成。JSF动态用户界面:包括
在名为menu.xhtml
<h:body>
<ui:composition>
<div class="menu_header">
<h2>
<h:outputText value="#{msg['menu.title']}" />
</h2>
</div>
<div class="menu_content">
<с:if test="#{authenticationBean.user.role.roleId eq '2'}">
<ui:include src="/pages/content/body/student/studentMenu.xhtml"/>
</с:if>
<с:if test= "#{authenticationBean.user.role.roleId eq '1'}">
<ui:include src="/pages/content/body/tutor/tutorMenu.xhtml" />
</с:if>
</div>
</ui:composition>
我知道,使用JSTL我不更好的解决办法,但我找不到其他。我的问题最好的决定是什么?
相关:http://stackoverflow.com/questions/3342984/jstl-in-jsf2-facelets-makes-sense – BalusC
@BalusC你认为使用h:panelGroup呈现在我的情况会更好吗? – Ray
不可以。您将最终得到两个包含而不是一个,因为'render'属性是在视图渲染时期间评估的,而不是像JSTL那样在视图构建期间进行评估。 – BalusC