Craig R. McClanahan wrote:

Can't you just embed your <bean:write> tag inside a <pre> element and get
the same effect?

Craig

pre opens a can of worms if the designers/managers are picky. For one, it roots the browsers ability to word wrap. Use a regex in your action code or some funky tag and replace them with <br /> 's before output. It's the only way to get a true representation.

Arron.



On Wed, 23 Oct 2002, Inge Solvoll wrote:


Date: Wed, 23 Oct 2002 14:25:48 +0200
From: Inge Solvoll <[EMAIL PROTECTED]>
Reply-To: Struts Developers List <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: HTML formatting of newline characters with bean:write tag

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>




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





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