File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes PropertyNotFoundException? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "PropertyNotFoundException?" Watch "PropertyNotFoundException?" New topic


Aaron Raja
Ranch Hand

Joined: Jun 07, 2007
Posts: 206
javax.faces.el.PropertyNotFoundException: Error testing property 'firstName' in bean of type null ?

Any clue?

I am trying to use
following stuff in my jsp
<td align="right" class="requiredlable">First Name:</td>
<h:inputText value="#{registration.userInfo.firstName}" id="fname"
My registration bean
public class Registration {

public Registration() {
userInfo = new User();
private User userInfo;
private String password;
private String confirmPassword;
private String message;
private String secrateKey;
private String userType;
private List userTypeList;
all getter and setter
My user Class
public class User {

private String userId;
private String loginName;
public String firstName;
private String lastName;
private String company;
private String userType;
private Long customerNumber;
private String customerLocation;
private long status;
private boolean emailOptIn;

private long inactivatedBy;
private Date inactivatedOn;

public User() {

all getter and setter



Thanks, AR
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

I tried the same thing. Its working. Please check the getters and setters name of your classes. It may be due to that.

My Blog SCJP 5 SCWCD 5
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Originally posted by Aaron Raja:
javax.faces.el.PropertyNotFoundException: Error testing property 'firstName' in bean of type null ?

<h:inputText value="#{registration.userInfo.firstName}"

Make sure that registration.getUserInfo() doesn't return null. With other words, instantiate it. You can instantiate it directly in the property declaration or assign it from somewhere inside the constructor or initialization block of the backing bean class.
I agree. Here's the link:
subject: PropertyNotFoundException?
It's not a secret anymore!