2

我声明了一个名为item的变量

并创建一个bundle。它包含一些数据如下

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.
4

1 回答 1

1

代替<ui:include src="#{bundle.#{item}}"/>

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

于 2012-07-08T13:04:37.317 回答