1
public class SuperUser extends User implements Serializable{
  private static final long serialVersionUID = 1L;

  private String username;

  private String pin;

 //getters and setters
 }

when I use this in a managed bean and try to access it in the facelets file like this

<h:inputText id="firstName" value="#{userManager.superUser.firstName}" required="true" maxlength="30" size="30"/>

I get an exception

javax.el.PropertyNotFoundException: /superUser/create.xhtml @18,96 value="#{userManager.superUser.firstName}": Target Unreachable

Does that mean the you cannot extend java beans if you want to access their properties?

Thanks

Farouk Alhassan
  • 3,612
  • 9
  • 46
  • 73

2 Answers2

3

It just means that #{userManager.superUser} returned null and hence setFirstName() cannot be called on it. JSF won't create nested object properties for you. You have to do it yourself.

To fix this, just ensure inside the backing bean class behind #{userManager} that it's not null. E.g.

private SuperUser superUser = new SuperUser();
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
0

Is the method getFirstName() inside User class public?

Similarly, is getSuperUser() of the userManager managed bean public?

adarshr
  • 57,189
  • 21
  • 133
  • 158