myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simon <simon.kitch...@chello.at>
Subject Re: Passing Parameters Through EL
Date Thu, 29 May 2008 20:35:13 GMT

On Thu, 2008-05-29 at 15:52 -0300, Paulo Angelo wrote:
> Hi ppl,
> 
>     I am trying to pass parameters through EL, something like:
> 
> ... #{Bean.method('1')} ..

That's not part of the JSF specification. EL doesn't support passing
parameters in any version of JSF (with a special exception for map
lookups).

One reason why EL does NOT support passing arbitrary params from JSF
pages is that you are not supposed to have logic in the pages. Pages are
meant to simply *display* data that your java code has computed. So
maybe the fact that you want to pass parameters is a hint that you
should rethink how your page works.

However if you definitely want to do this, then there are two options.

(1)
With JSF1.2 (or JSF1.1+facelets) you can register a static method with
the EL engine, then call it from el. So for example, you could write a
method
  public static void invokeMethod(MyBean bean, int param)
then invoke it from your page:
  #{myns:invokeMethod(bean, 1)}

(2)
If you want to pass just a single param, you can use a "map hack".

See:
  http://wiki.apache.org/myfaces/Parameters_In_EL_Functions

Regards,
Simon


Mime
View raw message