Perhaps escape quotes? \' ?

michał

On 30/03/07, Michael Heinen <[EMAIL PROTECTED]> wrote:
A simpler sample:

attribute="#{ MyBean.checkA ? 'alert('aaa');':'alert ('bbb');'}"

results in org.apache.commons.el.parser.ParseException: Encountered "? \'alert (\' 
aaa" at line 1, column 52.

Michael


-----Original Message-----
From: Michael Heinen [mailto:[EMAIL PROTECTED]
Sent: Freitag, 30. März 2007 15:28
To: MyFaces Discussion
Subject: RE: escaping in EL?

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





--
[EMAIL PROTECTED]
http://stawicki.jasliska.pl
GG: 3691111
JID: [EMAIL PROTECTED]

Reply via email to