webtier@glassfish.java.net

JSF 2.0 in Glassfish 3: Calling vararg methods with the EL

From: <webtier_at_javadesktop.org>
Date: Fri, 26 Mar 2010 10:17:49 PDT

Is the new EL 2.1 approach for calling methods supposed to work with varargs methods? In general, I am able to pass arguments to methods, including overloaded methods. For example, these work fine:

#{testBean2.greeting(false)}
-- One version of greeting takes a boolean

#{testBean2.greeting()}
-- Another version of greeting takes no args but does not start with "get"

#{testBean2.randomNumber(5)}
-- randomNumber takes a double

However, I define "min" as follows:
public int min(int ... numbers) { ... }

In that case, #{testBean2.min(3,2,1)} results in an error that says "wrong number of arguments" (presumably because it thinks min should take an int[]). Is this a bug or the expected behavior? If expected, where in the EL 2.1 spec does it say that varargs methods are forbidden?

I am using Glassfish 3.0 final (build 74.2). Note that passing args to methods in the EL works only in Java EE 6 servers. So none of the above examples will work in Tomcat 6 + Mojarra.

Thanks!

- Marty
--------------------------------
JSF 2.0 Training Course: http://courses.coreservlets.com/public-courses/jsf2/
[Message sent by forum member 'martyhall']

http://forums.java.net/jive/thread.jspa?messageID=393918