This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "PropertyNotFoundException?" Watch "PropertyNotFoundException?" New topic
Author

PropertyNotFoundException?

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
=================================
<tr>
<td align="right" class="requiredlable">First Name:</td>
<td>
<h:inputText value="#{registration.userInfo.firstName}" id="fname"
required="true"/>
</td>
</tr>
=================================
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
.............


}

==============
faces-config.xml
=======
<managed-bean>
<managed-bean-name>Registration</managed-bean-name>
<managed-bean-class>com.bias.webcenter.ui.bean.Registration</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<!--oracle-jdev-comment:managed-bean-jsp-link:1reguser.jsp-->
</managed-bean>


Thanks, AR
SCWCD 5, SCJP 1.4, OCA (PL/SQL)
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: http://aspose.com/file-tools
 
subject: PropertyNotFoundException?
 
Similar Threads
multi-step user registration ?
No getter method for property ename of bean org.apache. struts.taglib.html. BEAN
Help needed in resource file
How to find method in Sturts
error occuring while use jsp