On a somewhat related note, I've been wondering if the EL-functions as 
discussed here shouldn't have an implicit pageContext argument.

For instance, if the TLD specified a function like:

   <function>
     <name>isUserInRole</name>
     <function-class>mypkg.MyFunctions</function-class>
     <function-signature>
       boolean isUserInRole(PageContext, String)
     </function-signature>
   </function>

the page author could simply write:

   ${my:isUserInRole('editor')}

without needing to pass the pageContext object. The EL-engine would take 
care about that. I personally think the page author would expect a 
EL-function to get informed about the page context automatically, and 
that many useful functions would need access to it.

Anyway, I should probably send this to the JSP-group, just wanted to 
hear if anyone else thinks it'd be a good idea... Thoughts?

Shawn Bayern wrote:
> On Tue, 15 Oct 2002, James Cook wrote:
> 
> 
>>I wonder why the unnecessary complication here? If they are going to
>>use reflection anyway, why subject the users to creating these extra
>>xml fragments. A nickname hardly seems worth it, and adding another
>>point where a slight syntax problem in an XML document can cause
>>additional time deploying and debugging seems pointless.
>>
>>I hope they see the light and allow EL to invoke _any_ method
>>(including non-static) on beans that are exposed in a scoped context,
>>ala Velocity, et al
> 
> 
> The definition of functions instead of methods was the subject of a lot of
> debate.  While you're right to point out that it's a little more
> complicated for the developer who's defining the functions, the hope was
> that it would ultimately be easier for page authors and that it would
> facilitate good application design.  Functions can abstract data types,
> while allowing method calls from the EL specifically avoids this
> abstraction.  If you have pages that use expressions like
> 
>  ${myList.size()}
> 
> then you can't easily change the data type of 'myList' from, say, a List
> to an array.  However, if we provide a standard 'size' function, then page
> authors can write
> 
>  ${size(myList)}
> 
> without worrying how 'myList' is implemented.
> 
> Moreover, it would be poor practice to encourage the use of methods with
> side effects; if we allowed all method calls, we'd simply be reintroducing
> scriptlets with a different syntax.
> 
> Still, the topic is not one on which everyone agrees; functions do seem
> safest for the moment, however.
> 


-- 
Christopher Lenz
/=/ cmlenz at gmx.de


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to