This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PropertyNotFoundException?

 
Aaron Raja
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried the same thing. Its working. Please check the getters and setters name of your classes. It may be due to that.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic