Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [faces-dev] Outstanding enhancement request for Jakarta EL

Hi Mark,

the code is exactly the same.
JSF (MyFaces and Mojarra) always uses createMethodExpression with AjaxBehaviorEvent.class as param and invokes it.
"component" is just some EL, it could also be #{bean.method(bean1, bean2, bean3)}

Everything else is handled by the EL impl and the EL impl asks the ELResover for bean1, bean2, bean3?

Best regards,
Thomas



Virenfrei. www.avast.com

Am Mi., 3. Feb. 2021 um 19:55 Uhr schrieb Mark Thomas <markt@xxxxxxxxxx>:
Hi Thomas,

Thanks for the explanation. That helps a lot. I've managed to find the
implementation that supports:

<f:ajax event="click" listener="#{bean.method}" />

in the Mojarra source. I'm struggling a little with this one:

<f:ajax event="click" listener="#{bean.method(component)}" />

Can you provide me with a few pointers to the code paths that are
followed to a) set that listener up and b) execute it?

My current thinking is that this is something that would need to be
addressed in Mojarra. Whether that would require something like a new
implicit object "event", a custom MethodExpression or something else is TBD.

At this point I don't think this is something that would require a
change in EL but there might be something EL could do to simplify things.

Thanks,

Mark


On 02/02/2021 16:21, Thomas Andraschko wrote:
> Hi Mark,
>
> let me explain the problem a bit, maybe we can create a plain EL
> testcase then.
> Not even sure if there is a nice way to support this. Maybe its even
> only a misuse of EL in JSF.
>
> Here is a simple XHMTL:
> <h:inputText>
>     <f:ajax event="click" listener="#{bean.method}" />
> </h:inputText>
>
> In general JSF defines that this method can receive no params or
> AjaxBehaviorEvent (or even custom event in PrimeFaces but i will ignore
> this fact now).
>
> java:
> @Named
> @RequestScoped
> public class Bean {
>     public void method() { }
>     public void method(AjaxBehaviorEvent e) { }
> }
>
> So JSF use createMethodExpression with AjaxBehaviorEvent as parameter
> class and then invoke it.
> This works when no params or AjaxBehaviorEvent is defined as parameter
> in the bean.
>
>
> There is another case how a user can pass custom params to that method:
>
> <f:ajax event="click" listener="#{bean.method(component)}" />
>
> public void method(UIComponent component) { }
>
> In this case "component" is resolved by a custom ELResolver.
>
>
> The issue discussed in the GitHub link is a combination of both.
> How can i receive the param from JSF (AjaxBehaviorEvent) and pass my
> custom UIComponent?
>
> <f:ajax event="click" listener="#{bean.method(xxx, component)}" />
>
> public void method(AjaxBehaviorEvent e, UIComponent component) { }
>
>
> AFAIR someone of the PF users used it like this:
> <f:ajax event="click"
> listener="#{bean.method(javax.faces.event.AjaxBehaviorEvent,
> component)}" />
>
> But im not sure if this is supposed to work or just a random behavior of
> the EL impl?
>
> Best regards,
> Thomas
>
>
> Am Di., 2. Feb. 2021 um 15:52 Uhr schrieb Manfred Riem
> <m_riem@xxxxxxxxxxx <mailto:m_riem@xxxxxxxxxxx>>:
>
>     Hi Mark,
>
>     This issue is still relevant
>
>     Thanks!
>
>     Kind regards,
>     Manfred Riem
>
>     -----Original Message-----
>     From: faces-dev <faces-dev-bounces@xxxxxxxxxxx
>     <mailto:faces-dev-bounces@xxxxxxxxxxx>> On Behalf Of Mark Thomas
>     Sent: Tuesday, February 2, 2021 5:05 AM
>     To: faces-dev@xxxxxxxxxxx <mailto:faces-dev@xxxxxxxxxxx>
>     Subject: [faces-dev] Outstanding enhancement request for Jakarta EL
>
>     Hi all,
>
>     Now Jakarta EE 9 is done and we can start looking to evolve the
>     Jakarta specifications I am working my way through the open issues
>     for Jakarta _expression_ Language where I found this decade plus old
>     request:
>
>     https://github.com/eclipse-ee4j/el-ri/issues/6
>
>     Is this still something that you are interested in seeing in EL? If
>     so, we can look at what we can do for Jakarta EE 10 (and I'll
>     probably have a bunch of additional questions). If not, I'll close
>     the issue.
>
>     Thanks,
>
>     Mark
>     _______________________________________________
>     faces-dev mailing list
>     faces-dev@xxxxxxxxxxx <mailto:faces-dev@xxxxxxxxxxx>
>     To unsubscribe from this list, visit
>     https://www.eclipse.org/mailman/listinfo/faces-dev
>     _______________________________________________
>     faces-dev mailing list
>     faces-dev@xxxxxxxxxxx <mailto:faces-dev@xxxxxxxxxxx>
>     To unsubscribe from this list, visit
>     https://www.eclipse.org/mailman/listinfo/faces-dev
>
>
> _______________________________________________
> faces-dev mailing list
> faces-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/faces-dev
>

_______________________________________________
faces-dev mailing list
faces-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/faces-dev

Back to the top