I'm trying to replace parts of a string in a JSP file in Alfresco (you can find it there).
More specifically, I want to display more information after the "fullName" on line 54. The information I need is stored in r.id as a string of the form "GROUP_something", where I want the "something". I can display the r.id without issues, as in the snippet below, but as soon as I try to use fn:replace to remove the GROUP_ prefix then it breaks down.
Original:
<h:outputText id="user-txt" value="#{r.fullName}" rendered="#{r.isGroup}" />
Works as well:
<h:outputText id="user-txt" value="#{r.fullName} (#{r.id})" rendered="#{r.isGroup}" />
Not working:
<h:outputText id="user-txt" value="#{r.fullName} (#{fn:replace(r.id, 'GROUP_', '')})" rendered="#{r.isGroup}" />
Full code: http://pastebin.com/w8AXWUH1
The full stack trace is as follows:
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
I can't understand this error, as other answers (eg this one or this one) advocate this exact method.
I also added the function taglib:
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
in the header.
Any help appreciated!
Edit: more info about the environment: I'm using the "bundle" version of Alfresco, using Tomcat 7.0.30 as a container. The following versions of the libraries are used:
- JSF Apache MyFaces v1.1.8 (myfaces-api-1.1.8.jar and myfaces-impl-1.1.8.jar)
- JSP Tomcat's built-in Jasper (jasper.jar)
- EL I think it's Tomcat's built-in Jasper-EL (through el-api.jar and jasper-el.jar), although Alfresco also bundles commons-el.jar (with Specification-Version: 2.0 and Implementation-Version: 1.0)