Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error testing property 'name' in bean of typ null ?

843842May 26 2006 — edited Mar 26 2008
hi friends ,
i ma new to jsf , i have done a small code to enter user name and pass word. upon clicking a button it will display welcome to jsf "username" .training.java and login.java bean is like this
package my;

package training;
public class UserBean implements serializable
{

private String name ;
private String password;

public void setName(String name)
{
this.name= name;
}
public String getName()
{
return name;
}
public void setPassword( String password)
{
this.password = password;
}

public String getPassword()
{
return password;
}
}



second class:
package training;
public class Login
{

UserBean user = new UserBean() ;
private String passwordConfirm;

public void setUser(String n)
{
this.user= n;
}
public String getUser()
{
return user;
}
public void setPasswordConfirm( String pwd)
{
this.passwordConfirm = pwd;
}

public String getPasswordConfirm()
{
return passwordConfirm ;
}
}




and the faces-config.xml is like this:
.....
.
<managed-bean>
<managed-bean-name>login</managed-bean-name>
<managed-bean-class>training.Login</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>userbean</property-name>
<value>#{loginUserBean}</value>
</managed-property>
<managed-bean>
<managed-bean-name>loginUserBean</managed-bean-name>
<managed-bean-class>training.UserBean</managed-bean-class>
<managed-bean-scope>none</manage-bean-scope>
</managed-bean>
...
...

and when i try this thru tomcat its giving the fallowing error
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error testing property 'name' in bean of type null
javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)

root cause
javax.faces.el.PropertyNotFoundException: Error testing property 'firstName' in bean of type null
com.sun.faces.el.PropertyResolverImpl.getType(PropertyResolverImpl.java:342)
com.sun.faces.el.impl.ArraySuffix.getType(ArraySuffix.java:240)
com.sun.faces.el.impl.ComplexValue.getType(ComplexValue.java:208)
com.sun.faces.el.ValueBindingImpl.getType(ValueBindingImpl.java:345)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:111)
javax.faces.component.UIInput.getConvertedValue(UIInput.java:713)
javax.faces.component.UIInput.validate(UIInput.java:638)
javax.faces.component.UIInput.executeValidate(UIInput.java:849)
javax.faces.component.UIInput.processValidators(UIInput.java:412)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:912)
javax.faces.component.UIForm.processValidators(UIForm.java:170)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:912)
;javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:342)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:78)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs

please tell me what is the problem
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 23 2008
Added on May 26 2006
3 comments
1,055 views