You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Airton Carrara <li...@gmail.com> on 2005/11/24 14:44:50 UTC

rendering a string

Hi,

how to render a string whose value is the jsf tag itself?

example:

a string barCode is assembled on myBean. Its value is something like

<img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
width= ' 1' height=50' border='0'> ....

I need it rendered on the page, but if I use <h:outputText
value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
write this tag direct on page, I see the bar code.

Thanks.

Regards,
Airton

Re: rendering a string

Posted by Marius Kreis <ma...@nulldevice.org>.
Hi Airton.
Why do you generate the html yourself? JSF should do this for you...
Just create a new HtmlGraphicImage, set the attributs as you like and 
then add it as a child to an existing component which you can get using 
UIViewRoot.getComponentByI() or something like this....

Airton Carrara wrote:
> Hi,
> 
> how to render a string whose value is the jsf tag itself?
> 
> example:
> 
> a string barCode is assembled on myBean. Its value is something like
> 
> <img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
> width= ' 1' height=50' border='0'> ....
> 
> I need it rendered on the page, but if I use <h:outputText
> value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
> write this tag direct on page, I see the bar code.
> 
> Thanks.
> 
> Regards,
> Airton
> 


Re: rendering a string

Posted by Airton Carrara <li...@gmail.com>.
You're right.
Thank you for your help.

Regards,


2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> Well in this case you're ignoring the great benefits of jsf....
> The big deal about jsf is that you can handle HTML tags like components
> of a user interface. I'm sure the web will tell you something about the
> component tree in jsf and how it is built.
> If you know about this, then you understand that you can add your tag as
> an object (component) to the page and forget about html in your code.
> Btw my first mail got something like a short info about how to insert
> the component.
>
> Airton Carrara wrote:
> > Yes... :-)
> >
> >
> > 2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> >
> >>Hello again.
> >>
> >>Nice having solved at least one problem. Let's face the next one.
> >>It sounds to me as if you create a string in your backing bean, which
> >>represents a jsf-tag, e.g. $tag = "<h:outputText value=\"hello world\">";
> >>Is this correct?
> >>And now you want to insert this string into your page and get it rendered?
> >>
> >>Airton Carrara wrote:
> >>
> >>>You're right, sorry.
> >>>
> >>>I've got confused with two problems I have: one I've posted you've
> >>>answered and it's ok.
> >>>
> >>>The other one, I have had not mentioned, I need to render the entire
> >>>tag stored on a string (not the string as is).
> >>>
> >>>Thank you very much.
> >>>
> >>>Regard,
> >>>Airton
> >>>
> >>>
> >>>2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> >>>
> >>>
> >>>>Well than I didn't get the point... and I still don't get it.
> >>>>I thought you want to output your <img>-Tags to actually diplay the
> >>>>images (which assemble a barcode?) at the webpage. In this case you use
> >>>>escape="false". But if you want to output the tag as-is, then the
> >>>>parameter escape="true" should do...
> >>>>
> >>>>Airton Carrara wrote:
> >>>>
> >>>>
> >>>>>Marius,
> >>>>>
> >>>>>escape="false" works inside the tag, ex:
> >>>>>
> >>>>><h:outputText escape="false"  value="<b>boldText</b>"/>
> >>>>>will render 'boldText' in bold, but neither '<b>' nor '</b>'.
> >>>>>
> >>>>>My needed is to render all the tag (<h:outputText.../>) stored in a
> >>>>>var on myBean class.
> >>>>>
> >>>>>Thanks.
> >>>>>
> >>>>>
> >>>>>2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> >>>>>
> >>>>>
> >>>>>
> >>>>>>To answer your question:
> >>>>>><h:outputText value="#{myBean.barCode}" escape="false"/>
> >>>>>>should work.
> >>>>>>
> >>>>>>
> >>>>>>Airton Carrara wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Hi,
> >>>>>>>
> >>>>>>>how to render a string whose value is the jsf tag itself?
> >>>>>>>
> >>>>>>>example:
> >>>>>>>
> >>>>>>>a string barCode is assembled on myBean. Its value is something like
> >>>>>>>
> >>>>>>><img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
> >>>>>>>width= ' 1' height=50' border='0'> ....
> >>>>>>>
> >>>>>>>I need it rendered on the page, but if I use <h:outputText
> >>>>>>>value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
> >>>>>>>write this tag direct on page, I see the bar code.
> >>>>>>>
> >>>>>>>Thanks.
> >>>>>>>
> >>>>>>>Regards,
> >>>>>>>Airton
> >>>>>>>
> >>>>>>
> >>>>>>
> >>
> >
>
>

Re: rendering a string

Posted by Marius Kreis <ma...@nulldevice.org>.
Well in this case you're ignoring the great benefits of jsf....
The big deal about jsf is that you can handle HTML tags like components 
of a user interface. I'm sure the web will tell you something about the 
component tree in jsf and how it is built.
If you know about this, then you understand that you can add your tag as 
an object (component) to the page and forget about html in your code.
Btw my first mail got something like a short info about how to insert 
the component.

Airton Carrara wrote:
> Yes... :-)
> 
> 
> 2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> 
>>Hello again.
>>
>>Nice having solved at least one problem. Let's face the next one.
>>It sounds to me as if you create a string in your backing bean, which
>>represents a jsf-tag, e.g. $tag = "<h:outputText value=\"hello world\">";
>>Is this correct?
>>And now you want to insert this string into your page and get it rendered?
>>
>>Airton Carrara wrote:
>>
>>>You're right, sorry.
>>>
>>>I've got confused with two problems I have: one I've posted you've
>>>answered and it's ok.
>>>
>>>The other one, I have had not mentioned, I need to render the entire
>>>tag stored on a string (not the string as is).
>>>
>>>Thank you very much.
>>>
>>>Regard,
>>>Airton
>>>
>>>
>>>2005/11/24, Marius Kreis <ma...@nulldevice.org>:
>>>
>>>
>>>>Well than I didn't get the point... and I still don't get it.
>>>>I thought you want to output your <img>-Tags to actually diplay the
>>>>images (which assemble a barcode?) at the webpage. In this case you use
>>>>escape="false". But if you want to output the tag as-is, then the
>>>>parameter escape="true" should do...
>>>>
>>>>Airton Carrara wrote:
>>>>
>>>>
>>>>>Marius,
>>>>>
>>>>>escape="false" works inside the tag, ex:
>>>>>
>>>>><h:outputText escape="false"  value="<b>boldText</b>"/>
>>>>>will render 'boldText' in bold, but neither '<b>' nor '</b>'.
>>>>>
>>>>>My needed is to render all the tag (<h:outputText.../>) stored in a
>>>>>var on myBean class.
>>>>>
>>>>>Thanks.
>>>>>
>>>>>
>>>>>2005/11/24, Marius Kreis <ma...@nulldevice.org>:
>>>>>
>>>>>
>>>>>
>>>>>>To answer your question:
>>>>>><h:outputText value="#{myBean.barCode}" escape="false"/>
>>>>>>should work.
>>>>>>
>>>>>>
>>>>>>Airton Carrara wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi,
>>>>>>>
>>>>>>>how to render a string whose value is the jsf tag itself?
>>>>>>>
>>>>>>>example:
>>>>>>>
>>>>>>>a string barCode is assembled on myBean. Its value is something like
>>>>>>>
>>>>>>><img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
>>>>>>>width= ' 1' height=50' border='0'> ....
>>>>>>>
>>>>>>>I need it rendered on the page, but if I use <h:outputText
>>>>>>>value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
>>>>>>>write this tag direct on page, I see the bar code.
>>>>>>>
>>>>>>>Thanks.
>>>>>>>
>>>>>>>Regards,
>>>>>>>Airton
>>>>>>>
>>>>>>
>>>>>>
>>
> 


Re: rendering a string

Posted by Airton Carrara <li...@gmail.com>.
Yes... :-)


2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> Hello again.
>
> Nice having solved at least one problem. Let's face the next one.
> It sounds to me as if you create a string in your backing bean, which
> represents a jsf-tag, e.g. $tag = "<h:outputText value=\"hello world\">";
> Is this correct?
> And now you want to insert this string into your page and get it rendered?
>
> Airton Carrara wrote:
> > You're right, sorry.
> >
> > I've got confused with two problems I have: one I've posted you've
> > answered and it's ok.
> >
> > The other one, I have had not mentioned, I need to render the entire
> > tag stored on a string (not the string as is).
> >
> > Thank you very much.
> >
> > Regard,
> > Airton
> >
> >
> > 2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> >
> >>Well than I didn't get the point... and I still don't get it.
> >>I thought you want to output your <img>-Tags to actually diplay the
> >>images (which assemble a barcode?) at the webpage. In this case you use
> >>escape="false". But if you want to output the tag as-is, then the
> >>parameter escape="true" should do...
> >>
> >>Airton Carrara wrote:
> >>
> >>>Marius,
> >>>
> >>>escape="false" works inside the tag, ex:
> >>>
> >>><h:outputText escape="false"  value="<b>boldText</b>"/>
> >>>will render 'boldText' in bold, but neither '<b>' nor '</b>'.
> >>>
> >>>My needed is to render all the tag (<h:outputText.../>) stored in a
> >>>var on myBean class.
> >>>
> >>>Thanks.
> >>>
> >>>
> >>>2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> >>>
> >>>
> >>>>To answer your question:
> >>>><h:outputText value="#{myBean.barCode}" escape="false"/>
> >>>>should work.
> >>>>
> >>>>
> >>>>Airton Carrara wrote:
> >>>>
> >>>>
> >>>>>Hi,
> >>>>>
> >>>>>how to render a string whose value is the jsf tag itself?
> >>>>>
> >>>>>example:
> >>>>>
> >>>>>a string barCode is assembled on myBean. Its value is something like
> >>>>>
> >>>>><img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
> >>>>>width= ' 1' height=50' border='0'> ....
> >>>>>
> >>>>>I need it rendered on the page, but if I use <h:outputText
> >>>>>value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
> >>>>>write this tag direct on page, I see the bar code.
> >>>>>
> >>>>>Thanks.
> >>>>>
> >>>>>Regards,
> >>>>>Airton
> >>>>>
> >>>>
> >>>>
> >>
> >
>
>

Re: rendering a string

Posted by Marius Kreis <ma...@nulldevice.org>.
Hello again.

Nice having solved at least one problem. Let's face the next one.
It sounds to me as if you create a string in your backing bean, which 
represents a jsf-tag, e.g. $tag = "<h:outputText value=\"hello world\">";
Is this correct?
And now you want to insert this string into your page and get it rendered?

Airton Carrara wrote:
> You're right, sorry.
> 
> I've got confused with two problems I have: one I've posted you've
> answered and it's ok.
> 
> The other one, I have had not mentioned, I need to render the entire
> tag stored on a string (not the string as is).
> 
> Thank you very much.
> 
> Regard,
> Airton
> 
> 
> 2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> 
>>Well than I didn't get the point... and I still don't get it.
>>I thought you want to output your <img>-Tags to actually diplay the
>>images (which assemble a barcode?) at the webpage. In this case you use
>>escape="false". But if you want to output the tag as-is, then the
>>parameter escape="true" should do...
>>
>>Airton Carrara wrote:
>>
>>>Marius,
>>>
>>>escape="false" works inside the tag, ex:
>>>
>>><h:outputText escape="false"  value="<b>boldText</b>"/>
>>>will render 'boldText' in bold, but neither '<b>' nor '</b>'.
>>>
>>>My needed is to render all the tag (<h:outputText.../>) stored in a
>>>var on myBean class.
>>>
>>>Thanks.
>>>
>>>
>>>2005/11/24, Marius Kreis <ma...@nulldevice.org>:
>>>
>>>
>>>>To answer your question:
>>>><h:outputText value="#{myBean.barCode}" escape="false"/>
>>>>should work.
>>>>
>>>>
>>>>Airton Carrara wrote:
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>how to render a string whose value is the jsf tag itself?
>>>>>
>>>>>example:
>>>>>
>>>>>a string barCode is assembled on myBean. Its value is something like
>>>>>
>>>>><img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
>>>>>width= ' 1' height=50' border='0'> ....
>>>>>
>>>>>I need it rendered on the page, but if I use <h:outputText
>>>>>value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
>>>>>write this tag direct on page, I see the bar code.
>>>>>
>>>>>Thanks.
>>>>>
>>>>>Regards,
>>>>>Airton
>>>>>
>>>>
>>>>
>>
> 


Re: rendering a string

Posted by Airton Carrara <li...@gmail.com>.
You're right, sorry.

I've got confused with two problems I have: one I've posted you've
answered and it's ok.

The other one, I have had not mentioned, I need to render the entire
tag stored on a string (not the string as is).

Thank you very much.

Regard,
Airton


2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> Well than I didn't get the point... and I still don't get it.
> I thought you want to output your <img>-Tags to actually diplay the
> images (which assemble a barcode?) at the webpage. In this case you use
> escape="false". But if you want to output the tag as-is, then the
> parameter escape="true" should do...
>
> Airton Carrara wrote:
> > Marius,
> >
> > escape="false" works inside the tag, ex:
> >
> > <h:outputText escape="false"  value="<b>boldText</b>"/>
> > will render 'boldText' in bold, but neither '<b>' nor '</b>'.
> >
> > My needed is to render all the tag (<h:outputText.../>) stored in a
> > var on myBean class.
> >
> > Thanks.
> >
> >
> > 2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> >
> >>To answer your question:
> >><h:outputText value="#{myBean.barCode}" escape="false"/>
> >>should work.
> >>
> >>
> >>Airton Carrara wrote:
> >>
> >>>Hi,
> >>>
> >>>how to render a string whose value is the jsf tag itself?
> >>>
> >>>example:
> >>>
> >>>a string barCode is assembled on myBean. Its value is something like
> >>>
> >>><img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
> >>>width= ' 1' height=50' border='0'> ....
> >>>
> >>>I need it rendered on the page, but if I use <h:outputText
> >>>value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
> >>>write this tag direct on page, I see the bar code.
> >>>
> >>>Thanks.
> >>>
> >>>Regards,
> >>>Airton
> >>>
> >>
> >>
> >
>
>

Re: rendering a string

Posted by Marius Kreis <ma...@nulldevice.org>.
Well than I didn't get the point... and I still don't get it.
I thought you want to output your <img>-Tags to actually diplay the 
images (which assemble a barcode?) at the webpage. In this case you use 
escape="false". But if you want to output the tag as-is, then the 
parameter escape="true" should do...

Airton Carrara wrote:
> Marius,
> 
> escape="false" works inside the tag, ex:
> 
> <h:outputText escape="false"  value="<b>boldText</b>"/>
> will render 'boldText' in bold, but neither '<b>' nor '</b>'.
> 
> My needed is to render all the tag (<h:outputText.../>) stored in a
> var on myBean class.
> 
> Thanks.
> 
> 
> 2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> 
>>To answer your question:
>><h:outputText value="#{myBean.barCode}" escape="false"/>
>>should work.
>>
>>
>>Airton Carrara wrote:
>>
>>>Hi,
>>>
>>>how to render a string whose value is the jsf tag itself?
>>>
>>>example:
>>>
>>>a string barCode is assembled on myBean. Its value is something like
>>>
>>><img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
>>>width= ' 1' height=50' border='0'> ....
>>>
>>>I need it rendered on the page, but if I use <h:outputText
>>>value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
>>>write this tag direct on page, I see the bar code.
>>>
>>>Thanks.
>>>
>>>Regards,
>>>Airton
>>>
>>
>>
> 


Re: rendering a string

Posted by Airton Carrara <li...@gmail.com>.
Marius,

escape="false" works inside the tag, ex:

<h:outputText escape="false"  value="<b>boldText</b>"/>
will render 'boldText' in bold, but neither '<b>' nor '</b>'.

My needed is to render all the tag (<h:outputText.../>) stored in a
var on myBean class.

Thanks.


2005/11/24, Marius Kreis <ma...@nulldevice.org>:
> To answer your question:
> <h:outputText value="#{myBean.barCode}" escape="false"/>
> should work.
>
>
> Airton Carrara wrote:
> > Hi,
> >
> > how to render a string whose value is the jsf tag itself?
> >
> > example:
> >
> > a string barCode is assembled on myBean. Its value is something like
> >
> > <img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
> > width= ' 1' height=50' border='0'> ....
> >
> > I need it rendered on the page, but if I use <h:outputText
> > value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
> > write this tag direct on page, I see the bar code.
> >
> > Thanks.
> >
> > Regards,
> > Airton
> >
>
>

Re: rendering a string

Posted by Marius Kreis <ma...@nulldevice.org>.
To answer your question:
<h:outputText value="#{myBean.barCode}" escape="false"/>
should work.


Airton Carrara wrote:
> Hi,
> 
> how to render a string whose value is the jsf tag itself?
> 
> example:
> 
> a string barCode is assembled on myBean. Its value is something like
> 
> <img src='b.gif' width= ' 1' height=50' border='0'><img src='w.gif'
> width= ' 1' height=50' border='0'> ....
> 
> I need it rendered on the page, but if I use <h:outputText
> value="#{myBean.barCode}"/>, I get the string as is. Obviously, if I
> write this tag direct on page, I see the bar code.
> 
> Thanks.
> 
> Regards,
> Airton
>