Another way to do it is to create a wrapper method in your form that does the replacing. So if you have a text property in the form, create a textAsHTML method that return the test property with the line breaks replaced. That could get ugly if you have lots of fields like that, so I would then suggest using a taglib. What's the downfall in adding another taglib? I think it is certainly cleaner than the scriplet method you have below.

Daniel Perry wrote:

usefull...
though it adds yet another tag library to my pages!

best i came up with is:

<% pageContext.setAttribute("lf", "\n"); %>
<c:out value="${fn:replace(employee.contactAddress,lf, '<br>')}"
escapeXml="false"/>


is there really no escape sequence for new line in el?

Would seem like a rather big shortfall to me!

Daniel.


-----Original Message-----
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: 25 May 2004 18:17
To: Struts Users Mailing List
Subject: Re: nl2br equivalent?


http://jakarta.apache.org/taglibs/doc/string-doc/index.html#replace

----- Original Message -----
From: "Daniel Perry" <[EMAIL PROTECTED]>
To: "Struts User List" <[EMAIL PROTECTED]>
Sent: Tuesday, May 25, 2004 5:50 PM
Subject: nl2br equivalent?



I am a bit surprised, but there doesn't seem to be an

equivalent to php's

incredibly useful nl2br in jstl...

Is there an easy method I'm missing that will output a string after
converting line breaks to <br> tags?

Daniel.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to