troubleshooting Question

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

Avatar of pacchureddy
pacchureddy asked on
5 Comments1 Solution5582 ViewsLast Modified:


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: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


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros