This content has been marked as final.
Show 2 replies
-
1. Re: Stupid <br> question
mail.micke Nov 13, 2008 6:37 AM (in response to kirkor.grzegorz.bernas.com.pl)Hi
You could create a Facelets function or a Seam component to do this (since the enhanced EL allows for parameter passing).
@Name("myHelper") @Scope(APPLICATION) public class MyHelper ...{ public String nlToBr(final String str){ String retVal = null; retVal = //replacing the new lines return retVal; } }
Then in the xhtml you can do this:
<h:outputText value="#{myHelper.nlToBr(myBacking.theText)}"/>
Or create a facelets function and have this:
<h:outputText value="#{foo:nlToBr(myBacking.theText)}"/>
- Micke
-
2. Re: Stupid <br> question
kapitanpetko Nov 13, 2008 9:57 AM (in response to kirkor.grzegorz.bernas.com.pl)If all you want to do is preserve line breaks when displaying user-entered text,
you could just set white-space: pre in CSS for your text areas. Like so:<h:inputTextarea rows="3" cols="40" readonly="true" value="#{mybean.remark}" style="white-space: pre" />