Hi Kevin, 

the component you're looking for is OutputRaw:
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/OutputRaw.html

If you prefer to code your own component with MarkupWriter you'd do it like 
that:

public class PlainOutput {

@Parameter
private String text;

void beginRender(MarkupWriter writer) {
  // any string operation may be here, null-checks etc.
  writer.writeRaw(text);
}

void afterRender(MarkupWriter writer) {
  writer.write("Cheers");
  writer.writeRaw("<br />");
  writer.write("Christian");
}

}


Am 06.02.2013 um 06:30 schrieb Kevin White:

> I have a chunk of UTF-8 text that came from a database table.  It has
> embedded CRLFs in it, so that if you grab the text out of the table, it
> breaks up into long lines of text with blank lines in between them.  The
> intention is that a program capable of word-wrapping the text would then
> display it, turning it into formatted paragraphs and leaving the blank
> lines.
> 
> I'm using Tapestry 5.3.6 to display the text.  I'm having trouble. 
> Obviously, if I just print the field, Tapestry nicely HTML encodes it,
> escaping any bad characters.  But then, of course, the CRLFs disappear,
> and I get one large chunk of text.
> 
> So, I brilliantly replaced all the CRLF characters with <br>...and
> Tapestry equally brilliantly encoded the < > characters in my text,
> resulting in the on-screen display of the literal <br>.
> 
> So, here's what I think I want to do:
> 
> a) Call whatever function is in Tapestry to HTML escape/encode my text
> b) then replace CRLF with <br>
> c) then use OutputRaw to output it
> 
> The problem is: I can't figure out that first step: what method is
> called by Tapestry in the Output component.  Well, it appears to be in
> the MarkupWriter.
> 
> Instead of a) as written, maybe I actually need to create an instance of
> some sort of implementation of MarkupWriter that lets me write just my
> string and get the output as a string.  Is that the right path?
> 
> Anyways, thanks, and I'm open for any other/better suggestions on how to
> accomplish this.
> 
> Kevin
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to