myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From laredotornado <laredotorn...@gmail.com>
Subject Re: How to elegantly replace line breaks with <BR> tag?
Date Mon, 22 Feb 2010 20:40:47 GMT

Getting closer, but when I put in this ...

        <f:facet name="detailStamp">
			<h:panelGrid styleClass="table-reportsTamperComment" columns="1"
border="0">
				<f:facet name="header">
					<h:outputText value="Tampering Comments"/>
				</f:facet>
				<h:outputText escape="false" value="<pre>" />
				<t:outputText value="#{currentRow.tamperingMsg}" />
				<h:outputText escape="false" value="</pre>" />
			</h:panelGrid>
        </f:facet>

this is what is rendered ...

<table border="0" class="table-reportsTamperComment">
<thead><tr><th scope="colgroup" colspan="1">
Tampering Comments
</th></tr></thead><tbody><tr><td><pre></td></tr>
<tr><td>Nothing.  Looks ok to me.</td></tr>
<tr><td></pre></td></tr>
</tbody></table>


Any idea how to get the three lines you sent put into a single table cell? -
Dave





Jakob Korherr wrote:
> 
> <h:outputText escape="false" value="<pre>" />
> <t:outputText id="vehicleInfo"
> value="#{currentRow.result}"/>
> <h:outputText escape="false" value="</pre>"/>
> 
> Regards,
> Jakob
> 
> 
> 2010/2/22 laredotornado <laredotornado@gmail.com>
> 
>>
>> Thanks for brainstorming other solutions.  I really like the "<pre>" tag
>> solution, but when I do this, JSF is stripping out the "<pre>" tag when
>> the
>> HTML is rendered ...
>>
>>        <t:column>
>>          <f:facet name="header">
>>            <t:outputText value="Result"/>
>>          </f:facet>
>>          <!-- Vehicle Info -->
>>          <pre><t:outputText id="vehicleInfo"
>> value="#{currentRow.result}"/></pre>
>>        </t:column>
>>
>> It is also stripping out the comment.  Any idea how to re-write this so
>> JSF
>> keeps the <pre> tag in there? - Dave
>>
>>
>>
>> Jakob Korherr wrote:
>> >
>> > Hmm. You could write your own JSF component or you could try my
>> suggested
>> > solution from before and manually escape HTML entities!
>> >
>> > Or you know, you could use the HTML <pre> tag.
>> >
>> > Regards,
>> > Jakob
>> >
>> > 2010/2/22 laredotornado <laredotornado@gmail.com>
>> >
>> >>
>> >> I am printing back text the user entered so there is no guarantee that
>> >> they
>> >> will enter it in a particular format.
>> >>
>> >> This can't be that hard ... replacing "\n" with HTML-recognizable <BR>
>> >> tags.
>> >> Surprisingly, Google is coming up empty on this one.  Any additional
>> help
>> >> is
>> >> appreciated, - Dave
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> struberg wrote:
>> >> >
>> >> > why not use <ul> and <li> elements and later format your
output via
>> >> CSS?
>> >> >
>> >> > LieGrue,
>> >> > strub
>> >> >
>> >> > --- laredotornado <laredotornado@gmail.com> schrieb am Mo,
>> 22.2.2010:
>> >> >
>> >> >> Von: laredotornado <laredotornado@gmail.com>
>> >> >> Betreff: Re: How to elegantly replace line breaks with <BR>
tag?
>> >> >> An: users@myfaces.apache.org
>> >> >> Datum: Montag, 22. Februar, 2010 19:34 Uhr
>> >> >>
>> >> >> Will JSF escape the "<BR/>" and make it
>> >> >> "&lt;BR/&gt;"?  I still want other
>> >> >> "HTML" characters like "&" and "<" escaped.
>> >> >>
>> >> >>  - Dave
>> >> >>
>> >> >>
>> >> >>
>> >> >> Jakob Korherr wrote:
>> >> >> >
>> >> >> > Hi,
>> >> >> >
>> >> >> > You can provide a special getter method in your
>> >> >> managed bean for that
>> >> >> > (something like getResultWithLineBreaks()) and replace
>> >> >> "\n" with "<br />"
>> >> >> > in
>> >> >> > the return value of method. Then you have to change
>> >> >> your t:outputText
>> >> >> > component to:
>> >> >> >
>> >> >> > <t:outputText
>> >> >> value="#{currentRow.resultWithLineBreaks}" escape="false"
>> >> >> />
>> >> >> >
>> >> >> > Regards,
>> >> >> > Jakob
>> >> >> >
>> >> >> > 2010/2/22 laredotornado <laredotornado@gmail.com>
>> >> >> >
>> >> >> >>
>> >> >> >> Hi,
>> >> >> >>
>> >> >> >> I'm using MyFaces 1.1.5 with Tomahawk 1.1.7 (Java
>> >> >> 1.5, Resin, 3.0.19).
>> >> >> >> Is
>> >> >> >> there a way in JSF where I can replace the "\n"
>> >> >> (chr(13) carriage return
>> >> >> >> character) with the "<BR/>" tag in my
>> >> >> outputText block?  Right now I have
>> >> >> >>
>> >> >> >> <t:outputText value="#{currentRow.result}"
>> >> >> />
>> >> >> >>
>> >> >> >> Thanks, - Dave
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>> http://old.nabble.com/How-to-elegantly-replace-line-breaks-with-%3CBR%3E-tag--tp27690198p27690198.html
>> >> >> >> Sent from the MyFaces - Users mailing list archive
>> >> >> at Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://old.nabble.com/How-to-elegantly-replace-line-breaks-with-%3CBR%3E-tag--tp27690198p27692067.html
>> >> >> Sent from the MyFaces - Users mailing list archive at
>> >> >> Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> > __________________________________________________
>> >> > Do You Yahoo!?
>> >> > Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden
>> >> Schutz
>> >> > gegen Massenmails.
>> >> > http://mail.yahoo.com
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/How-to-elegantly-replace-line-breaks-with-%3CBR%3E-tag--tp27690198p27692517.html
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-elegantly-replace-line-breaks-with-%3CBR%3E-tag--tp27690198p27693370.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-elegantly-replace-line-breaks-with-%3CBR%3E-tag--tp27690198p27694035.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message