Link to home
Start Free TrialLog in
Avatar of pacchureddy
pacchureddy

asked on

replace/remove the space from variable using jstl's replace function


Hi


I have a variable called"CurrentState" and this is getting displayed in my jsp as:

      <c:out value="${currentState}"/>

The posiible values for currentState like: North Carolina , West Virginia ..etc..,

I am trying to get rid of the space inside the variable; like i wanted to get "NortCarolina" instead of "North Carolina"

Here is what I did:

      <c:set var="currState" value="${currentState}" />

       <c:forEach var="currState" items="${currentState}">                    
                                   ${fn:replace(currState.value,' ', '')}
                              </c:forEach>
                       
            <c:out value="${currState}"/>

I think the syntax is somewhat wrong. It doesnt work..  can anyone give me the correct syntax including the tglib uri for this "fn" tag

Thanks
Prashanthi


Avatar of bloodredsun
bloodredsun
Flag of Australia image

<c:out value="${fn:replace(currentState,' ', '')}"/>

fn:replace is normally used inside either a c:out or c:set. a more detailed decription can be found here http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html?page=2
Avatar of pacchureddy
pacchureddy

ASKER

hey

Thanks for responding... I am getting aorg.apache.taglibs.standard.lang.jstl.parser.ParseException: EL functions are not supported.'
Do i need to import a taglib for using "fn" I did tried to downlaod fn.tld ,,but couldnt find it....
ASKER CERTIFIED SOLUTION
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I give it.... you are right!!!!
Cheers :-)