我正在使用JSF 1.2编写的一个相当大的应用程序.JSF 1.2现在已经有6年了.我需要升级到JSF 2.0.这会有多痛苦?我注意到自定义标签中的一些属性已被更改等.
我正在尝试实现一个复合组件,该组件以纯文本显示用户的信息详细信息,或者如果所需的详细信息是当前连接的用户的详细信息,则通过可编辑的输入文本字段显示它们.
我知道al UI Components可以通过渲染属性渲染,但是那些不是UI组件的东西(例如div)
<div class = "userDetails" rendered = "#{cc.attrs.value.id != sessionController.authUser.id}">
Name: #{cc.attrs.value.name}
Details: #{cc.attrs.value.details}
</div>
<div class = "userDetails" rendered = "#{cc.attrs.value.id == sessionController.authUser.id}">
<h:form>
...
</h:form>
</div>
Run Code Online (Sandbox Code Playgroud)
我知道div没有渲染属性,可能我根本没有采用正确的方法.我可以很容易地使用JSTL标签,但我想避免这种情况.
我有一个主页xhtml,我根据条件包括3个孩子xhtml.我面临的问题是,无论情况如何,Book.xhtml总是被调用.我将渲染条件更改为false或移出到另一个条件,但始终调用该文件由于其调用其支持bean而导致不必要的开销.请给我一个解决方案
<ui:composition template="/xhtml/baseLayout.xhtml">
<ui:define name="browserTitle">
<h:outputText value="HOME PAGE" />
</ui:define>
<ui:define name="header">
<ui:include src="/xhtml/header.xhtml" />
</ui:define>
<ui:define name="bodyContent">
<h:panelGrid width="100%"
rendered="#{pogcore:isRoleAuthorized(BUNDLE.SUPER)}" >
<ui:include src="/xhtml/SuperUser.xhtml" />
</h:panelGrid>
<h:panelGrid width="100%"
rendered="#{pogcore:isRoleAuthorized(BUNDLE.MAINTENANCE)}" >
<ui:include src="/xhtml/Maintenance.xhtml" />
</h:panelGrid>
<h:panelGrid width="100%"
rendered="#{pogcore:isRoleAuthorized(BUNDLE.PRINT)}">
<ui:include src="/xhtml/Book.xhtml" />
</h:panelGrid>
</ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)