• Post Reply Bookmark Topic Watch Topic
  • New Topic

Substring function in JSF  RSS feed

 
Marcel Frehner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSTL there is a nice function fn:substringAfter(string,string) which allows me to "cut off" a prefix. For instance:

<c ut value="${fn:substringAfter("first.name",".")}"/> returns "name".

Now the problem is, that my value is a JSF variable. I couldn't find an equivalent JSF function and something like:

<jsfh utputText value="#{${fn:substringAfter(myVar,'.')}}"/>

does not work (assuming that myVar="first.name").

What can I do?
 
Marcel Frehner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting somewhat closer to a solution.

1) I might just set (and truncate) a new JSP variable in the session scope like this:
<c:set var="test" value="${fn:substringAfter(sessionScope['searchContext'].attributes['esriAGSFindResults'].resultRows[0].field,'.')}" scope="session"/>

2) And then access it with JSF like this:
<jsfh utputText value="#{sessionScope.test}" />

Unfortunately I want to use this formatting in one column of a jsfh ataTable. The JSF iterating through the rows seems to be out of scope for JSTL functions.
I could possibly write an extension of the resultRows class which formats truncates the field values. Is this the way how it's done?

Cheers Marcel
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!