I'm pulling and setting a section Title variable
<c:set var="sectionTitle" value="${section.sectionTitle}"/>
But the variable can possibly have spaces and apostrophes (single quotes) and I'm using the variable as a class, and the space and apostrophe is breaking the code when either show up, so I would like replace both with an underscore.
<c:set var="search" value="[ ']"/>
<c:set var="replace" value="_"/>
<c:set var="newTitle" value="${fn:replace(sectionTitle, search, replace)}"/>
This is what I have come up with. The reason for this, is that the "newTitle" shows up a lot in the code, and I would rather paste ${newTitle} rather than the full function, plus I can add to the search array if anything else comes up.
Unfortunately, I can not get this to work. The replace function does not replace any of it.
Any suggestions?