2012-07-08 50 views
2

我宣佈了一個名爲項目如何從資源包使用上飛(動態)訪問值生成的密鑰

變量,並創建一個。它包含一些數據如下

StudentAdd=student/Create.xhtml 
StudentEdit=student/Edit.xhtml 
StudentList=student/List.xhtml 
DepartmentAdd=department/Create.xhtml 

我想通過可變數據

這裏的變化,包括不同的XHTML頁面是我的XHTML代碼

<c:forEach items="#{ajaxBean.chcekItem}" var="item" varStatus="loop"> 
        <p:tab id="#{item}" title="#{item}" closable="true">        
         <ui:include src="#{bundle.#{item}}"/> 

        </p:tab> 
       </c:forEach> 

我可以試試上面的方法,但表現出以下錯誤信息......

/index.xhtml @57,66 src="#{bundle.#{item}}" The identifier [#] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true. 

回答

1

,而不是<ui:include src="#{bundle.#{item}}"/>

使用<ui:include src="#{bundle[item]}"/>

+0

謝謝您的回答 – 2012-07-08 13:19:33

+0

歡迎您也來看看這個:http://www.mkyong.com/jsf2/jsf-2-0-and-resource-bundles-example / – Daniel 2012-07-08 13:21:34

相關問題