1

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)
Community
  • 1
  • 1
Florent
  • 186
  • 1
  • 8
  • show complete jsp page code – sunysen Sep 25 '13 at 00:04
  • 1
    Never seen this one before. Which JSF impl/version? EL impl/version? Try ` ` instead. – BalusC Sep 25 '13 at 01:36
  • Hi BalusC, I tried wrapping the outputText in panelGroup, but the error stayed the same. I updated the post with more information about the libraries version. Thanks for looking into it :) – Florent Sep 25 '13 at 03:50
  • Take a look https://issues.alfresco.com/jira/browse/MNT-6303 – newuser Sep 25 '13 at 06:10
  • Did you write the `` in such way that it represents the sole individual EL expression? Wrapping in panel group is not by itself the key, it's just in order to print the desired `` with `id`. So, write your code like this: ` ()` – BalusC Sep 25 '13 at 11:06

0 Answers0