javax.faces.el.ReferenceSyntaxException:表达式中不支持的函数。功能:fn:替换

时间:2013-09-24 23:53:55

标签: jsp jsf el

我正在尝试替换Alfresco中的JSP文件中的部分字符串(您可以找到它there)。

更具体地说,我想在第54行的“fullName”之后显示更多信息。我需要的信息作为“GROUP_something”形式的字符串存储在r.id中,我想要“某事”。我可以在没有问题的情况下显示r.id,如下面的代码段所示,但是一旦我尝试使用fn:replace来删除GROUP_前缀,它就会崩溃。

原件:

<h:outputText id="user-txt" value="#{r.fullName}" rendered="#{r.isGroup}" />

也适用:

<h:outputText id="user-txt" value="#{r.fullName} (#{r.id})" rendered="#{r.isGroup}" />

不工作:

<h:outputText id="user-txt" value="#{r.fullName} (#{fn:replace(r.id, 'GROUP_', '')})" rendered="#{r.isGroup}" />

完整代码:http://pastebin.com/w8AXWUH1

完整堆栈跟踪如下:

javax.faces.FacesException: An exception occurred processing JSP page /jsp/dialog/container.jsp at line 194

191: 
192: 
193: 
194: " />
195: 
196: 
197: 


Stacktrace:
caused by:
org.apache.jasper.JasperException: An exception occurred processing JSP page /jsp/dialog/container.jsp at line 194

191: 
192: 
193: 
194: " />
195: 
196: 
197: 


Stacktrace:
caused by:
org.apache.jasper.JasperException: javax.faces.FacesException: Exception while calling encodeEnd on : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dialog/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dialog][Class: javax.faces.component.UINamingContainer,Id: dialog-body][Class: org.alfresco.web.ui.common.component.UIPanel,Id: users-panel][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: users-list][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: _idJsp17][Class: javax.faces.component.html.HtmlOutputText,Id: user-txt]}
caused by:
javax.faces.FacesException: Exception while calling encodeEnd on : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dialog/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dialog][Class: javax.faces.component.UINamingContainer,Id: dialog-body][Class: org.alfresco.web.ui.common.component.UIPanel,Id: users-panel][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: users-list][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: _idJsp17][Class: javax.faces.component.html.HtmlOutputText,Id: user-txt]}
caused by:
javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dialog/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dialog][Class: javax.faces.component.UINamingContainer,Id: dialog-body][Class: org.alfresco.web.ui.common.component.UIPanel,Id: users-panel][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: users-list][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: _idJsp17][Class: javax.faces.component.html.HtmlOutputText,Id: user-txt]}
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{r.fullName} (#{fn:replace(r.id, 'GROUP_', '')})'
caused by:
javax.faces.el.ReferenceSyntaxException: Functions not supported in expressions. Function: fn:replace

我无法理解这个错误,因为其他答案(例如this onethis one)提倡这种确切的方法。

我还添加了函数taglib:

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
标题中的

任何帮助表示赞赏!

编辑:有关环境的更多信息:我正在使用Alfresco的“捆绑”版本,使用Tomcat 7.0.30作为容器。使用以下版本的库:

  • JSF Apache MyFaces v1.1.8(myfaces-api-1.1.8.jar和myfaces-impl-1.1.8.jar)
  • JSP Tomcat的内置Jasper(jasper.jar)
  • EL 认为它是Tomcat的内置Jasper-EL(通过el-api.jar和jasper-el.jar),虽然 Alfresco还捆绑了commons-el.jar(规范版本:2.0和实现版本:1.0)

0 个答案:

没有答案
相关问题