Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

fn:replace JSTL tag trick for replacing carrige returns....how?

843836Apr 5 2005 — edited Jan 16 2007
Hi

I have some <textarea> input that I would like to format for display.
My question is: How can I use fn:replace tag to replace carriage returns to
so that formatted input looks like exactly as entered in by user?

Doing
string.replaceAll("\r\n|\n","<br/>");
works fine from within a servlet but not if use fn:replace.....This is what I tried
                    <c:set var="msg" value="${param.message}"/>
                    ${fn:replace(msg, "\\r\\n|\\n", "<br/>")}
This doesn't work...
I have to use double backslashes in fn:replace - otherwise I get JSTL error.


Can someone tell me what am I doing wrong...
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2007
Added on Apr 5 2005
7 comments
1,300 views