Reputation: 21893
I've got a span like this
<span>${bean.name}</span>
and it returns something like John Brown
how can i format it so it shows like BROWN, John in jstl?
Upvotes: 1
Views: 888
Reputation: 1108732
So, to the point, you want to apply the following modifications on the String
:
This is all doable with JSTL functions.
<c:set var="parts" value="${fn:split(bean.name, ' ')}" />
${fn:toUpperCase(parts[1])}
,
${parts[0]}
Summarized:
<c:set var="parts" value="${fn:split(bean.name, ' ')}" />
${fn:toUpperCase(parts[1])}, ${parts[0]}
You've only another problem when the name contains more than one space.
Upvotes: 2