File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF

 
kamiya sei
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a project called MyJSF, when deploy user will fill their information but appear an error , I don't know how to slove this problem, help me repair them

/User.xhtml @20,81 value="#{userBean.getUser}": Property 'getUser' not found on type ManagedBean.UserBean

here are code of JSF Managed Bean


package ManagedBean;

public class UserBean {

User curUser = new User();

public String getUser() {
if (curUser.name.equals("") || curUser.city.equals("") || curUser.phone == 0 || curUser.age == 0) {

return "/Error.xhtml";
} else {
return "/success.xhtml";
}
}
}


and class User.java include getter and setter


package ManagedBean;


public class User {

String name;
String city;
int phone;
int age;

public User() {
}

public User(String name, String city, int phone, int age) {
this.name = name;
this.city = city;
this.phone = phone;
this.age = age;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String getCity() {
return city;
}

public void setCity(String city) {
this.city = city;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getPhone() {
return phone;
}

public void setPhone(int phone) {
this.phone = phone;
}
}
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17646
39
Android Eclipse IDE Linux
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hebert Coelho wrote:Try #{userBean.user}


The "get" part is not merely redundant/incorrect, it's potentially harmful. When you make an EL reference to a bean property on an input control, the "get" method brings the value out for display, but it's the set method that takes the user's input and posts it into the backing bean.

In fact, that's what distinguishes the "$" notation from the "#" notation. The older "$" expressions were read-only.
 
kamiya sei
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks all .


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic