• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PropertyNotFoundException?

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic