Properly expanding HTML code in Facelets

View: New views
3 Messages — Rating Filter:   Alert me  

Properly expanding HTML code in Facelets

by Paulo Pinto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

I am having the following problem. If I try to use the following code

<div class="some_class">
  #{bean.method}
</div>

where bean.method() returns a HTML snippet, I want the HTML to be processed by the browser,
instead I get a very strange behavior.

Lets say the above code gets translated into:


<div class="some_class">
  <p>my own <b>snippet</b></p>
</div>

Now I want the elements to be properly shown in the browser, instead they seem to be outside the DOM
tree and get shown as is.

As anyone had a similar problem? How did you solve it? <ui:fragment> or <ui:compoment> don't seem to work.

Thanks in advance,
Paulo

Re: Properly expanding HTML code in Facelets

by lincolnbaxter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try <h:outputText value="#{bean.method}" encode="false" >

On Mon, Sep 7, 2009 at 8:30 AM, Paulo Pinto<pjmlp@...> wrote:

> Hi everyone,
>
> I am having the following problem. If I try to use the following code
>
> <div class="some_class">
>   #{bean.method}
> </div>
>
> where bean.method() returns a HTML snippet, I want the HTML to be processed
> by the browser,
> instead I get a very strange behavior.
>
> Lets say the above code gets translated into:
>
>
> <div class="some_class">
>   <p>my own <b>snippet</b></p>
> </div>
>
> Now I want the elements to be properly shown in the browser, instead they
> seem to be outside the DOM
> tree and get shown as is.
>
> As anyone had a similar problem? How did you solve it? <ui:fragment> or
> <ui:compoment> don't seem to work.
>
> Thanks in advance,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Properly expanding HTML code in Facelets

by Paulo Pinto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, it worked.

On Mon, Sep 7, 2009 at 4:18 PM, Lincoln Baxter, III <lincolnbaxter@...> wrote:
Try <h:outputText value="#{bean.method}" encode="false" >

On Mon, Sep 7, 2009 at 8:30 AM, Paulo Pinto<pjmlp@...> wrote:
> Hi everyone,
>
> I am having the following problem. If I try to use the following code
>
> <div class="some_class">
>   #{bean.method}
> </div>
>
> where bean.method() returns a HTML snippet, I want the HTML to be processed
> by the browser,
> instead I get a very strange behavior.
>
> Lets say the above code gets translated into:
>
>
> <div class="some_class">
>   <p>my own <b>snippet</b></p>
> </div>
>
> Now I want the elements to be properly shown in the browser, instead they
> seem to be outside the DOM
> tree and get shown as is.
>
> As anyone had a similar problem? How did you solve it? <ui:fragment> or
> <ui:compoment> don't seem to work.
>
> Thanks in advance,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...