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

any feedback, Mark? :)

Am Fr., 5. Feb. 2021 um 12:19 Uhr schrieb Thomas Andraschko <tandraschko@xxxxxxxxxx>:
Hi Mark,

just to be clear, this is what JSF always does and i dont think that this should be changed, everything should be in EL.

MethodExpression me = ExpressionFactory#createMethodExpression(context, expressionString, new Class[] { AjaxBehaviorEvent.class })
me.invoke(context, new Object[] {  ajaxBehaviorEventInstance });


I think there are 2 solutions for the EL specs / impl:

1) add a syntax to reference a "implicit" param, maybe similar to JS:
    #{bean.method(arguments[0],  someVar)}

2) add some auto-lookup-magic into EL, like you mentioned in the last mail

I >personally< like 1) more as it forces the user to think about the method-mapping and is more flexible.
2) is of course also nice but we need a lot of fallbacks. Not sure about the performance here, but probably the resolved method is cached in the "MethodExpression" instance?

Best regards,
Thomas


Am Fr., 5. Feb. 2021 um 11:50 Uhr schrieb Mark Thomas <markt@xxxxxxxxxx>:
Hi Thomas,

Thanks for this. I think we are on the same page.

I have most of a possible solution already implemented in Tomcat. I have
some questions around the details that I hope you'll be able to help me
with.

Is it expected that the user will need to do something to explicitly
declare that the 'implicit' parameter should be inserted or if the user
provides an _expression_ string like:

#{bean.method(someVar)}

will JSF first look for

void method(Object someVar)

and if that is not found look for

void method(AjaxBehaviorEvent event, Object someVar)

?

Re-phrasing in terms of your expressions below, should _expression_ 3 and
4 have different syntax or is it expected that when presented with an
_expression_ like 3, faces will first look for a method like 3 and if one
isn't found look for a method like 4?

I hope this question makes sense.

Mark


On 04/02/2021 20:41, Thomas Andraschko wrote:
> Hi Mark,
>
> sounds right but i will try to explain with some other words.
>
> JSF always does:
> MethodExpression me = ExpressionFactory#createMethodExpression(context,
> expressionString, new Class[] { AjaxBehaviorEvent.class })
> me.invoke(context, new Object[] {  ajaxBehaviorEventInstance });
>
> There are no 3 expressionStrings supported by it:
>
> 1) #{bean.method} / void method(AjaxBehaviorEvent e)
>     This means that we receive the "implicit" parameter from JSF
>
> 2) #{bean.method()}  / void method()
>    This means we receive no param
>
> 3) #{bean.method(someOtherVarWhichWillBeResolvedByELImplAndELResolver)}
> / void method(Object someVar)
>     This means we receive a "explicit" parameter, defined by the user
> and resolved by a ELResolver
>
> But this is not supported:
>
> 4) #{bean.method(???,
> someOtherVarWhichWillBeResolvedByELImplAndELResolver } / void
> method(AjaxBehaviorEvent e, Object someVar)
>     This means that the user would like to take the "implicit" param
> from JSF and one or multiple "explicit" parameters.
>     AFAIR someone of the PrimeFaces users wrote
> "javax.faces.event.AjaxBehaviorEvent" instead of "???" but not sure if
> its defined by the specs or even works correctly.
>
> Hope its 100% understandable now :)
>
> Best Regards,
> Thomas
>
>
> Am Do., 4. Feb. 2021 um 18:55 Uhr schrieb Mark Thomas <markt@xxxxxxxxxx
> <mailto:markt@xxxxxxxxxx>>:
>
>     On 04/02/2021 17:46, Mark Thomas wrote:
>     > Hi Thomas,
>     >
>     > Thanks. I think I understand now. The issue is simpler than I realised
>     > from looking at the the Mojarra code.
>     >
>     > To summarise this from an EL perspective:
>     >
>     > When you create a MethodExpression you can either:
>     > - provide the parameters values; or
>     > - provide the parameter types.
>     >
>     > These are used to find the required method.
>     >
>     > When you invoke a MethodExpression you can either:
>     > - provide the parameter vales; or
>     > - if parameter values were provided at the point the MethodExpression
>     >   was created you can use those.
>
>     Small correction. Parameters provided at the point of creation take
>     priority over those provided at invocation.
>
>     > What you want to do is insert an additional parameter at the point the
>     > method is invoked.
>     >
>     > Does that sound right?
>     >
>     > 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
> 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