2012-07-08 53 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

相关问题