I suggest that rather than using - preserveLineFeed - it would make more
sense to say encodeLineFeed and default to false. This makes more sense
to me since the former is a bit misleading as the line feeds are still
preserved, just not in a way that a HTML browser understands. I am
willing to do the patch which I can do tomorrow or day after if no else
is doing this. Inge?

chanoch


-------------------------------------------------------------

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer. Although we routinely screen for viruses,
recipients should check this e-mail and any attachment for viruses. We
make no warranty as to absence of viruses in this e-mail or any
attachments.


-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@;apache.org] 
Sent: 24 October 2002 17:09
To: Struts Developers List
Subject: Re: HTML formatting of newline characters with bean:write tag


+0 on adding an attribute to control this (patches welcome).

-1 on making the default to insert <br>s, because this would break
backwards compatibility.  Our practice in Struts, whenever something
previously hard coded is now made configurable, is to maintain the
previous behavior as the default.

Craig

On Thu, 24 Oct 2002, Inge Solvoll wrote:

> Date: Thu, 24 Oct 2002 11:12:19 +0200
> From: Inge Solvoll <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: Re: HTML formatting of newline characters with bean:write tag
>
> I actually didn't think of creating a tag that can be wrapped around 
> the bean:write tag, that's obviously the best solution for me. I'll 
> check if there is something like that in Jakarta taglib. I believe 
> someone here mentioned a 'replace' tag.
>
> But, for me this is still an interesting question. The web application

> I'm working on is very big and has a lot of text input and output. All

> of our inputted text should preserve linebreaks. Text entered in 
> regular text fields doesn't have linebreaks anyway, and text from 
> textareas should have breaks. I see that it isn't too pretty code to 
> always insert BR-tags in bean:write, but couldn't this at least be an 
> option, like this:
>
> bean:write name="myBean" property="myProp" preserveLineFeed="false",
>
> where preserveLineFeed would be true by default? The tag would then 
> use a method like the breakNewlines(String) method suggested below.
>
> For my web application this would be far more elegant than wrapping 
> another custom tag around every single bean:write that needs to 
> preserve line breaks. As I said, the need to preserve linebreaks is 
> very common in my experience, I rarely want to NOT preserve 
> linebreaks... At least for me because most of the text that is 
> outputted is text inputted by a user in a textfield or textarea.
>
> The bean:write tag already has an attribute "filter" that escapes 
> HTML-formatting, which in my opinion covers the same kind of thing, 
> how the output looks when rendered in html, why is it not elegant to 
> do the same thing for linebreaks?
>
> At 12:02 23.10.2002 -0500, you wrote:
> >There are already taglibs that do this transformation, aren't there? 
> >Doesn't the taglibs project have things that address this?  Is there 
> >a way to do this using the JSTL (Martin?)?
> >
> >David Graham wrote:
> >
> >>If this is a common problem, maybe we could add a method to Action 
> >>like
> >>breakNewLines(String) that does this transformation.  The
<bean:write>
> >>tag should not do any transformation, just display what it's given.
> >>
> >>What do you think?
> >>
> >>Dave
> >
> >
> >--
> >Eddie Bush
> >
> >
> >
> >
> >--
> >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>


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