wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Return type and parameters for deferred method signature in EL >= 2.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Return type and parameters for deferred method signature in EL >= 2.1" Watch "Return type and parameters for deferred method signature in EL >= 2.1" New topic

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

Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

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. :-)


    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?).

    OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
    I agree. Here's the link: http://aspose.com/file-tools
    subject: Return type and parameters for deferred method signature in EL >= 2.1
    Similar Threads
    struts2: select tag and parameters property of bean
    overriding / overloading
    Can I take SCWCD 1.4 having SCJP 1.2?
    Draft objectives for SCWCD 1.4
    SCWCD 1.4 FREE Beta Voucher Info