File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF" Watch "JSF" New topic
Author

JSF

kamiya sei
Greenhorn

Joined: Dec 12, 2012
Posts: 25
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

Joined: Jul 14, 2010
Posts: 754

Try #{userBean.user}


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
kamiya sei
Greenhorn

Joined: Dec 12, 2012
Posts: 25
thanks all .


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF
 
Similar Threads
select in hibernate
Use of @Before and @After annotation with example..
Unable to Access mysql database through JNDI.
cannot find symbol
detached entity passed to persist