You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Sonia Garavito <so...@gmail.com> on 2005/01/06 23:05:15 UTC

problems with html embebed in a

greetings
actually i'm writing a code  where do i need to render an attribute
from a backing bean that throws a string with html tags

//backinbean
public class Bean  {
         ...
	private String page1 ="<table><tr><td>hello</td></tr></table>";
        ...
public String getPage1(){
        return page1;
}

//my page jsf

<h:form id="coordinateForm" >
<f:verbatim escape="true">
 <h:outputText	   id="pageLabel" value="#{bean.page1}"/>
</f:verbatim>
</h:form>

and the output I got is the code html is:
<table><tr><td>hello</td></tr></table>
I need to get this code rendered correctly, as a table with one row
one column and the word hello.

i'll apreciate any help
thanks
Sonia Garavito

Re: problems with html embebed in a

Posted by Sean Schofield <se...@gmail.com>.
Sonia,

I am relatively new to faces but I will do my best to try and help.

Are you sure you gave us the right input/output?  Because it looks
like you rendered ouput is exactly what I would expect.  You told the
bean to generate the exact same HTML as what you got.

Also, I don't think its necessary to have <f:verbatim> around
something that is already a faces tag.  The verbatim is really to help
you with dynamically included web pages that mix regular text and JSP
with JSF tags (so everything is rendered in the correct order.)

Finally, I wouldn't recommend trying to create a table this way.  You
should be using the <h:panelGrid> instead.

HTH,
sean

On Thu, 6 Jan 2005 17:05:15 -0500, Sonia Garavito
<so...@gmail.com> wrote:
> greetings
> actually i'm writing a code  where do i need to render an attribute
> from a backing bean that throws a string with html tags
> 
> //backinbean
> public class Bean  {
>         ...
>        private String page1 ="<table><tr><td>hello</td></tr></table>";
>        ...
> public String getPage1(){
>        return page1;
> }
> 
> //my page jsf
> 
> <h:form id="coordinateForm" >
> <f:verbatim escape="true">
> <h:outputText     id="pageLabel" value="#{bean.page1}"/>
> </f:verbatim>
> </h:form>
> 
> and the output I got is the code html is:
> <table><tr><td>hello</td></tr></table>
> I need to get this code rendered correctly, as a table with one row
> one column and the word hello.
> 
> i'll apreciate any help
> thanks
> Sonia Garavito
>

Re: problems with html embebed in a

Posted by Heath Borders <he...@gmail.com>.
On the <h:outputText /> tag there is an "escape" attribute.  This
escapes the String to be literally viewable in a browser.  Set
"escape" to false and it will render real HTML code.


On Thu, 6 Jan 2005 17:05:15 -0500, Sonia Garavito
<so...@gmail.com> wrote:
> greetings
> actually i'm writing a code  where do i need to render an attribute
> from a backing bean that throws a string with html tags
> 
> //backinbean
> public class Bean  {
>         ...
>        private String page1 ="<table><tr><td>hello</td></tr></table>";
>        ...
> public String getPage1(){
>        return page1;
> }
> 
> //my page jsf
> 
> <h:form id="coordinateForm" >
> <f:verbatim escape="true">
> <h:outputText     id="pageLabel" value="#{bean.page1}"/>
> </f:verbatim>
> </h:form>
> 
> and the output I got is the code html is:
> <table><tr><td>hello</td></tr></table>
> I need to get this code rendered correctly, as a table with one row
> one column and the word hello.
> 
> i'll apreciate any help
> thanks
> Sonia Garavito
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org