users@glassfish.java.net

Re: GlassFish V3 b66 doesn't support unified EL method parameters (JSR-245)

From: <glassfish_at_javadesktop.org>
Date: Fri, 09 Oct 2009 21:59:18 PDT

Thank you, that worked.

I wanted to try methods that don't start with "get" to see if they would work. I may have found a couple of bugs. I started with the following code. First I noticed that NetBeans 6.8 M2 does not offer tag completion for methods that have parameters, so I created a bug ticket 174275.

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:body>
        Value is #{fantasyBean.someMethodWithParam('test')};
    </h:body>
</html>

package sandbox.jee6web1;

import javax.faces.bean.ManagedBean;

@ManagedBean
public class FantasyBean {
    public String someMethodWithParam(String value) {
        return value;
    }
}


I works fine. If I remove the method parameter then NetBeans offers "someMethodWithParam" in EL completion. I changed the code to look like this:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:body>
        Value is #{fantasyBean.someMethodWithParam};
    </h:body>
</html>

package sandbox.jee6web1;

import javax.faces.bean.ManagedBean;

@ManagedBean
public class FantasyBean {
    public String someMethodWithParam() {
        return "test";
    }
}

When I run that code on GlassFish V3 b66 I get an exception:

/index.xhtml: The class 'sandbox.jee6web1.FantasyBean' does not have the property 'someMethodWithParam'.

One time I got this exception instead:

/index.xhtml: Method someMethodWithParam not found

So I changed the code to look like this, then it works in GlassFish:

public String getSomeMethodWithParam() {
        return "test";
}

Should NetBeans not offer EL completion for methods that have zero parameters AND do not start with "get"? Or, should JSF/EL let me use methods with no parameters that do not start with "get"?


Thanks,
Ryan
[Message sent by forum member 'rdelaplante' (ryan_at_ijws.com)]

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