This does not work.

The "?" must be part of the EL expression, or ?

What I want is that if MyBean.checkA is true, then  
doJS('staticvalue','#{beanA.value}'); should be printed into the attribute 
value.
This expression has to be in single quotes.
The problem is that the JavaScript parameters in this function call have to be 
also in single quotes.

Something like your suggestion:
onclick=#{MyBean.checkA}?'doJS('staticvalue','#{beanA.value}');':'alert('hello'));'"
is rendered as 

true?'doJS('staticvalue','bla');':'alert('hello'));'

Michael

-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED] 
Sent: Donnerstag, 29. März 2007 17:42
To: MyFaces Discussion
Subject: Re: escaping in EL?

Are you trying to do this?

onclick=#{MyBean.checkA}?'doJS('staticvalue','#{beanA.value}');':'alert('hello'));'"

Only put #{} around parts you want interpreted by EL.

On 3/29/07, Michael Heinen <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I want to express the following Javascript function call via EL:
>
>
>
> <sometag
>
> onclick=#{MyBean.checkA?'doJS('staticvalue','#{beanA.value}');':'alert('hello'));'}"
>
> </sometag>
>
>
>
> How can I do this ?
>
> Is there any way to escape this stuff ?
>
>
>
> Thanks,
>
> Michael

Reply via email to