Jason
Jason

Reputation: 1309

Any JSTL or Spring methods that handles URL like this?

So I have my JSTL tags like following

<a href="${urlHeader}hfv/${curRow.postTitle}">

</a>

If the curRow.postTitle is "TEST TEST" and when I click the link, the postTitle segment of the URL becomes "TEST%20TEST". What I want is "TEST_TEST" instead.

Does it have to be done before the data has been passed to the view or can you simply do it with an available JSTL or Spring tags?

Thanks.

Upvotes: 0

Views: 61

Answers (1)

Daniel Kaplan
Daniel Kaplan

Reputation: 67454

There is a JSTL tag in "functions" called replace that you can use to do this. It works similarly to String.replace. As the example shows, you can do something like this:

${fn:replace(url, " ", "_")}

Upvotes: 2

Related Questions