You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dave <ja...@yahoo.com> on 2007/03/29 18:53:18 UTC

how to include javascript selectively

How to include javascript conditionally in a page? It seems that ExtensionFilter is for this purpose?  For example,
   
  include javascript when #{bean.value == 1}
   
  Thanks for ideas.

 
---------------------------------
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.

Re: how to include javascript selectively

Posted by Mike Kienenberger <mk...@gmail.com>.
Have you tried something simple like

<h:panelGroup
     rendered="#{bean.value == 1}">
// include your javascript here
</h:panelGroup>

If you're using jsp, you'll need to put that into f:verbatim (which
might have a rendered flag already -- not sure about that one).


On 3/29/07, Dave <ja...@yahoo.com> wrote:
> How to include javascript conditionally in a page? It seems that
> ExtensionFilter is for this purpose?  For example,
>
> include javascript when #{bean.value == 1}
>
> Thanks for ideas.
>
>  ________________________________
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
>
>

Re: how to include javascript selectively

Posted by CD <dc...@gmail.com>.
Dave,

It's a hack but....

I use an outputText with the value being the javascript I want written.
Value for rendered attribute is set to whatever condition you require ( #{
bean.value == 1} per your example ).  I hate this approach, but it does
accomplish the purpose given my constrained env.

HTH,
CD


On 3/29/07, Dave <ja...@yahoo.com> wrote:
>
> How to include javascript conditionally in a page? It seems that
> ExtensionFilter is for this purpose?  For example,
>
> include javascript when #{bean.value == 1}
>
> Thanks for ideas.
>
> ------------------------------
> Never miss an email again!
> Yahoo! Toolbar<http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolbar/features/mail/>alerts you the instant new Mail arrives.Check it out.
>
>