You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Bill Schneider (JIRA)" <de...@myfaces.apache.org> on 2006/06/22 23:22:30 UTC

[jira] Commented: (TOMAHAWK-214) t:outputText attribute \n ->

    [ http://issues.apache.org/jira/browse/TOMAHAWK-214?page=comments#action_12417371 ] 

Bill Schneider commented on TOMAHAWK-214:
-----------------------------------------

This would be incredibly useful, yet it isn't as easy as it looks, in no small part because you have to do the newline conversion *after* escaping other special chars for HTML.

So it's not enough to override getValue() in Tomahawk's HtmlOutputText class.  Instead, you have to drag a big chunk of HtmlTextRendererBase from 'shared' into Tomahawk's own HtmlTextRenderer, to do both the escaping and the newline conversion at the right moment.   

It might be better to refactor the output text escaping/conversion into a separate method from the actual output writing, so that you have a way to override some behavior from Tomahawk's classes.  That way, the Tomahawk renderer could just do something like 

protected String getOutputText() { 
  String escaped = super.getOutputText();
  return StringUtils.replace(escaped, "\n", "<br>"); 
}

> t:outputText attribute \n -> <br/>
> ----------------------------------
>
>          Key: TOMAHAWK-214
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-214
>      Project: MyFaces Tomahawk
>         Type: New Feature

>     Reporter: Alexander Panzhin
>     Priority: Minor

>
> A boolean attribute, when set would convert '\n' to '<br/>'.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira