I looked at http://jumpstart.doublenegative.com.au/jumpstart/examples/component/coreinputcomponents and when I type in text in the text area that includes an end-of-line character, it gets displayed as two lines of text each surrounded with <p> and </p>. But in my own Tapestry application, when I display text with ${myText}, all my eol characters stay as eol characters and thus get ignored by the browser, showing up as one long line of text. Is there some way I can convert eol's to <br/> or something? Thanks. Tim Koop tim@timkoop.com <ma...@timkoop.com> www.timkoop.com <http://www.timkoop.com> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org
Posted by Markus Korth <m....@military.de>.
Am 18.04.2012 um 21:50 schrieb Tim: > >> Am 18.04.2012 um 20:32 schrieb Tim: >> >>> On 18/04/2012 1:25 PM, Martin Strand wrote: >>>> Another option is to leave the code as it is right now and fix this with CSS instead: >>>> >>>> p.mytext { >>>> white-space: pre; >>>> } >>> I originally did it this way, but I found that really long lines didn't wrap at all--they just went off the page. >> Why not using CSS for this: >> >> <span style="word-wrap: break-word;"> >> </span> > > Because I don't think it would solve the problem of converting eol to <br/> (but perhaps it might in combination of "white-space"), and it's not supported in Firefox or Opera. It wraps long lines, it's CSS3 standard and it works at least in Firefox, haven't tested Opera yet. Markus --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org
Posted by Tim <ko...@gmail.com>.
> Am 18.04.2012 um 20:32 schrieb Tim: > >> On 18/04/2012 1:25 PM, Martin Strand wrote: >>> Another option is to leave the code as it is right now and fix this with CSS instead: >>> >>> p.mytext { >>> white-space: pre; >>> } >> I originally did it this way, but I found that really long lines didn't wrap at all--they just went off the page. > Why not using CSS for this: > > <span style="word-wrap: break-word;"> > </span> Because I don't think it would solve the problem of converting eol to <br/> (but perhaps it might in combination of "white-space"), and it's not supported in Firefox or Opera. -- Tim Koop --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org
Posted by Markus Korth <m....@military.de>.
Am 18.04.2012 um 20:32 schrieb Tim: > On 18/04/2012 1:25 PM, Martin Strand wrote: >> Another option is to leave the code as it is right now and fix this with CSS instead: >> >> p.mytext { >> white-space: pre; >> } > > I originally did it this way, but I found that really long lines didn't wrap at all--they just went off the page. Why not using CSS for this: <span style="word-wrap: break-word;"> </span> Markus Grell --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org
Posted by Martin Strand <do...@gmail.com>.
On Wed, 18 Apr 2012 20:32:12 +0200, Tim <ko...@gmail.com> wrote: > On 18/04/2012 1:25 PM, Martin Strand wrote: >> Another option is to leave the code as it is right now and fix this >> with CSS instead: >> >> p.mytext { >> white-space: pre; >> } > > I originally did it this way, but I found that really long lines didn't > wrap at all--they just went off the page. Oh yes, that should be "pre-wrap" (won't work in older IEs) http://www.quirksmode.org/css/whitespace.html > Does anyone know a convenient and secure way to escape HTML? There's commons-lang: http://commons.apache.org/lang/api-2.5/org/apache/commons/lang/StringEscapeUtils.html#escapeHtml(java.lang.String) Btw, a third option is to create a loop over yourString.split("\n") and then put a line break after each line: <t:loop ...> ${currentRow} <br/> </t:loop> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org
Posted by Tim <ko...@gmail.com>.
On 18/04/2012 1:25 PM, Martin Strand wrote: > Another option is to leave the code as it is right now and fix this > with CSS instead: > > p.mytext { > white-space: pre; > } I originally did it this way, but I found that really long lines didn't wrap at all--they just went off the page. Does anyone know a convenient and secure way to escape HTML? -- Tim --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org
Posted by Martin Strand <do...@gmail.com>.
On Wed, 18 Apr 2012 19:47:11 +0200, Thiago H. de Paula Figueiredo <th...@gmail.com> wrote: > On Wed, 18 Apr 2012 14:06:02 -0300, Tim Koop <ti...@timkoop.com> wrote: > >> Is there some way I can convert eol's to <br/> or something? > > Like doing this conversion yourself using String.replaceAll() and using > OutputRaw in the template? If you do it this way, remember to escape any HTML characters first. Otherwise you could be introducing an XSS vulnerability since a user can type HTML into the textarea. Another option is to leave the code as it is right now and fix this with CSS instead: p.mytext { white-space: pre; } --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 18 Apr 2012 14:06:02 -0300, Tim Koop <ti...@timkoop.com> wrote: > Is there some way I can convert eol's to <br/> or something? Like doing this conversion yourself using String.replaceAll() and using OutputRaw in the template? -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org