When outputting text with the bean:write tag, it can be text that was entered by a user in a textarea. The text is submitted with \n (linefeed) characters, and in most cases that I can think of, these linefeeds should be preserved when outputted in HTML. Why isn't all newline characters translated into BR tags when outputted through the bean:write tags? In PHP, this functionality exists in the nl2br function, but I normally expect Struts to perform things like this in a more transparent and elegant way.

There is probably a reason for why this functionality doesn't exist, that I don't see right now. Or, it exists but I didn't do a good job looking for it?

Anyway, I solved the problem for myself by rewriting WriteTag in the taglib.bean package to perform the needed translation from \n to BR-tags. Clearly, this is not a very elegant way of solving the problem, so I would be very happy to get some feedback on this issue.

I hope this is the correct mailing list to submit this to, this is my first contact with this list. My company uses Struts extensively in an advanced way, and we often run into problems that there exists very little information about online. I believe these problems would be interesting for the Struts developers, so I will post a description later on.

Keep up the good work!

Inge :-)


--
To unsubscribe, e-mail: <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>

Reply via email to