Not very intuitive, but the following should work:

<c:set var="s5" value="First line\nSecond line"/>
<c:out value="${fn:replace(s5,'\\\n','<br>')}" escapeXml="false"/>


-- Pierre

Keith wrote:

I have a column in a database that is used to store a comments section. It's just a large string (VARCHAR2(4000) in Oracle), and the information is entered into it via a <textarea> form field. If I output that data to another <textarea> I can see that the return characters are preserved in the database.

I was trying to output this column's data as normal text in HTML, but need to preserve the returns somehow. I was thinking I could use the <fn:replace> action to turn them into <br>'s, but I'm not sure how it sees the return characters in the string. I tried this:

<c:out value="${fn:replace(row.comments, '\n', '<br>')}" />

But get this error back:

org.apache.jasper.JasperException: /filename.jsp(281,2) "${fn:replace
(row.comments, '\n', '<br>')}" contains invalid expression(s): javax.servlet.jsp.el.ELException: Encountered "'\n", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-
", "not", "!", "empty", <IDENTIFIER>]



Anyone help with how I can go about doing this? Thanks!


Keith

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