• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Return type and parameters for deferred method signature in EL >= 2.1

 
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Ranchers!

I'm just after the lecture of the new features of Unified Expression Language 2.2, and one of the most difficult topics for me is the deferred evaluation one... It took me some time to understand the concept and translate it into my own understanding :-)

The question is - as I understand it correctly, I can specify that my tag handler is taking a parameter which is a method to be invoked within the tag handler. It is different from the instant evaluation (which is also possible starting from EL 2.1), because the invocation of the method is left for the developer.

So, basically
should pass the ValueExpression (which is a parsed but not evaluated EL expression) to the tag handler named someTag.
To do so, I need to specify a method signature for myBean.method in a TLD in case of tag handlers and in <%@ attribute directive in case of Tag Files. The information I need to pass are:

  • method return type,
  • method name,
  • method parameters.

  • The method name is ignored by the container and replaced with the actual name which will be passed using #{...} expression.
    The method parameters are needed but it's the developer's responsibility to invoke the method with proper parameters.
    The return type is also not important (?), as this method doesn't return anything (well... WHERE should it return it?)

    So, what is the return type definition for in the <method-signature> element (subelement of <deferred-method>) in DD? If the method cannot return anything what is it for there? What is it's purpose?
    Also, why do I need to specify parameters if I still need to manually pass them in the tag handler?

    Is it only for some checking purposes, i.e. the EL during parsing is checking if the expression set in #{...} is referencing the method which actually has the given return type and parameters and name? Did I understand the deferred method evaluation concept correctly?

    Thanks in advance for your replies. :-)

    Cheers!
    ---------------------------------------------------------------------------

    EDIT: Ok, in the matter of fact I've tested it and Tomcat 7 is working fine if you won't pass the return type, i.e.:

    in Tag File (note - the name is ignored - there is no "xxx" method in MyTestObj class and there is no return type):

    Java Bean class:

    And the invocation page:


    Do we still need the return type for some purposes (what?).
     
    I think she's lovely. It's this tiny ad that called her crazy:
    Devious Experiments for a Truly Passive Greenhouse!
    https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
      Bookmark Topic Watch Topic
    • New Topic