i have find the answer, it is the jsf-api and jsf-impl.jar version must be 1_1_01. but i got new problem, my NameBean's code is
------------------------------------------------------------------------
public class NameBean {
private
String userName;
private TestBean testBean;
/**
* @return User Name
*/
public String getUserName() {
return userName;
}
/**
* @param User
* Name
*/
public void setUserName(String name) {
userName = name;
}
public String login() {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
TestBean testBean = (TestBean) application.createValueBinding(
"#{applicationScope.testBean}").getValue(context);
return "greeting";
}
public TestBean getTestBean() {
return testBean;
}
public void setTestBean(TestBean testBean) {
this.testBean = testBean;
}
}
--------------------------------------------------------------------
the TestBean code as follow:
-------------------------------------------------------------------
public class TestBean implements Serializable {
private String loginName = "willow";
public TestBean() {
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
}
---------------------------------------------------------------------
but when i excute in NameBean's login Method, i want to get the refrence of TestBean by follow code:
TestBean testBean = (TestBean) application.createValueBinding(
"#{applicationScope.testBean}").getValue(context);
but i got testBean is null, i have configure referenced bean in faces-config.xml file,
--------------------------------------
<referenced-bean><referenced-bean-name>testBean</referenced-bean-name> <referenced-bean-class>demo.TestBean</referenced-bean-class
</referenced-bean>
-----------------------------------------
why testBean is null? what's the problem?
[ July 27, 2005: Message edited by: willow david ]