JSTL tip, using fn:replace

June 23, 2005 on 12:51 am | In Java |

This piece of code will not work, despite one’s best efforts:

Neither will this:


However, this will work. Beats me.

<% pageContext.setAttribute("newline", "n"); %>
Related Posts:

6 Comments »

RSS feed for comments on this post.

  1. A possible bug in the implementation? Or in the specification?

    Comment by AnonymousDuke — 23 June 2005 #

  2. Nice tip!

    Comment by Vlad — 10 May 2006 #

  3. Thanks enormously for the tip! I would have spent a long time trying to find a work around…. or just given up entirely.

    Comment by Chadwick — 30 May 2006 #

  4. You’re most welcome.

    Eddy

    Comment by Eddy — 30 May 2006 #

  5. ${fn:replace(str, “\\n”, “”)} works…

    Comment by Cedric — 20 September 2006 #

  6. Sorry you have to double the backslah… It doesn’t appear when I leave the comment.

    ${fn:replace(str, “\ \ n”, )}

    Comment by Cedric — 20 September 2006 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>





Powered by blog.mu with Pool theme design by Borja Fernandez.