gpt4 book ai didi

parsing - 运行 JSF 页面错误 : Failed to parse the expression [${LogModel. getLogList()}]?

转载 作者:行者123 更新时间:2023-11-28 22:34:59 28 4
gpt4 key购买 nike

我正在使用 jsf 2 和 tomcat 6,我正在尝试执行我拥有的 .xhtml 页面中的这段代码:

    <h:dataTable value="${LogModel.getLogList()}" var="c"
styleClass="order-table"
headerClass="order-table-header"
rowClasses="order-table-odd-row,order-table-even-row"
>

我确实有类 logmodel 和方法 getLogList(),但是当我启动页面时出现此错误:

/testLog.xhtml @20,8 value="${LogModel.getLogList()}"无法解析表达式 [${LogModel.getLogList()}]

这里是问题的完整日志:

javax.faces.view.facelets.TagAttributeException: /testLog.xhtml @20,8 value="${LogModel.getLogList()}" Failed to parse the expression [${LogModel.getLogList()}]
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:401)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:351)
at com.sun.faces.facelets.tag.jsf.ComponentRule$ValueExpressionMetadata.applyMetadata(ComponentRule.java:107)
at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81)
at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:129)
at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.doNewComponentActions(ComponentTagHandlerDelegateImpl.java:398)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:159)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:769)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.el.ELException: Failed to parse the expression [${LogModel.getLogList()}]
at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:146)
at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:172)
at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:216)
at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:385)
... 34 more
Caused by: org.apache.el.parser.ParseException: Encountered " "(" "( "" at line 1, column 22.
Was expecting one of:
"}" ...
"." ...
"[" ...
">" ...
"gt" ...
"<" ...
"lt" ...
">=" ...
"ge" ...
"<=" ...
"le" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"&&" ...
"and" ...
"||" ...
"or" ...
"*" ...
"+" ...
"-" ...
"/" ...
"div" ...
"%" ...
"mod" ...

at org.apache.el.parser.ELParser.generateParseException(ELParser.java:2142)
at org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2024)
at org.apache.el.parser.ELParser.DynamicExpression(ELParser.java:147)
at org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:43)
at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:114)
... 38 more

非常感谢您的帮助!谢谢

最佳答案

EL 语法 ${LogModel.getLogList()} 仅在 EL 2.2 和 Servlet 3.0 之后才受支持。但是您使用的是旧的 Tomcat 6 服务器,它是一个 Servlet 2.5 容器,这意味着 EL 2.1。然后您需要使用普通的 EL 2.1 语法。

${LogModel.logList}

如果您真的坚持使用新的 EL 2.2 调用操作方法的语法,那么您总是可以按照此答案中的描述安装 JBoss EL:Invoke direct methods or methods with arguments / variables / parameters in EL但是,这对于随后可以通过更简单的 EL 语法访问的简单 getter 方法没有任何意义。

初学者的一个主要误解是他们认为这种新的 EL 2.2 语法是特定于 JSF 2.0 的。但事实并非如此。造成这种混淆是因为 EL 2.2 和 JSF 2.0 都是 Java EE 6 的一部分,但 JSF 2.0 本身向后兼容 Java EE 5(Servlet 2.5、EL 2.1 等)。

关于parsing - 运行 JSF 页面错误 : Failed to parse the expression [${LogModel. getLogList()}]?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10988250/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com