• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JSF

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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;
}
}
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try #{userBean.user}
 
Saloon Keeper
Posts: 28807
212
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks all .


 
I think I'll just lie down here for a second. And ponder this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic