reset password
Author Message
se1k1h1mawar1
Posts: 121
Posted 11:36 Dec 02, 2014 |

It may be an obvious thing to some, but wanted to make sure I am making the right kind of associations.

The API for EL Functions reads:

If an EL expression uses a function (for example ${fn:toUpperCase(customer.name)}), then a FunctionMapper object must also be specified within the ELContext. The FunctionMapper is responsible to map ${prefix:name()} style functions to static methods that can execute the specified functions.
https://docs.oracle.com/javaee/5/api/javax/el/package-summary.html#Functions

Is FunctionMapper the same thing as the contents of <function> in .tld file of a project, as in:

    <function>
        <name>leetTalk</name>
        <function-class>cs320.tag.Functions</function-class>
        <function-signature>java.lang.String leetTalk( java.lang.String
            )</function-signature>
    </function>

from our example codes?

Please let me know.Thank you.
 

Last edited by se1k1h1mawar1 at 11:38 Dec 02, 2014.
cysun
Posts: 2935
Posted 13:38 Dec 02, 2014 |

I think you are reading the documentation about the internal workings of EL. In particular, regarding FunctionMapper, what it says is that if you want to create an implementation of EL that supports EL function, you have to use a FunctionMapper to map the function name in JSP to its implementation (which is a static method in some class).

Note that we are not trying to implement EL here - we are just writing an EL function. The difference is like writing a Java compiler vs. writing a Java method. EL is already implemented by Tomcat (using FunctionMapper and what not). Writing an EL function only involves a static method and the <function> element in TLD.

se1k1h1mawar1
Posts: 121
Posted 14:39 Dec 02, 2014 |

I see! No wonder it all seemed very confusing to me.

Thank you for such a thorough and helpful response!