What have I done to be rewarded with a

I'm getting a org.apache.jasper.el.JspMethodNotFoundException

on one of my view pages .Here's what in the jsp :

<h:panelGrid width="375px" bgcolor="#ff8040" columns="2" border="0">

<f:facet name="header">

<h:outputText value="User Login" />

</f:facet>

<h:outputLabel for="userName" rendered="true">

<h:outputText value="#{bundle.user_name_label}" />

</h:outputLabel>

<h:inputText rendered="true" value="#{user.userName}"

id="userName"></h:inputText>

<h:outputLabel for="password" rendered="true">

<h:outputText value="#{bundle.user_password_label}" />

</h:outputLabel>

<h:inputSecret id="password" value="#{user.password}"

rendered="true"></h:inputSecret>

<h:outputText value="Existing User?" style="left: auto" />

<h:commandButton id="submit" action="#{user.login}"

value="#{bundle.login_button_label}" rendered="true" />

<h:outputText value="New User?" style="left: auto" />

<h:commandLink value=" Register Here" action="newuser" />

</h:panelGrid>

and then the managed bean :

@Entity

@Table(name ="USERS")

@NamedQuery(name="UserBean.findUnique",query="SELECT u FROM UserBean u WHERE u.userName=:userName AND u.password=:password ")

publicclass UserBean{

privatestatic Logger log = Logger.getLogger(UserBean.class.getName());

privatestatic List<UserBean> users =new ArrayList<UserBean>();

@Id

@GeneratedValue(strategy = GenerationType.AUTO)

@Column(name ="ID")

privateint id;

@Column(name ="USERNAME")

private String userName;

@Column(name ="PASSWORD")

private String password;

@Transient

private String verify;

public UserBean(){

}

public String getPassword(){

return password;

}

publicvoid setPassword(String password){

this.password = password;

}

public String getUserName(){

return userName;

}

publicvoid setUserName(String userName){

this.userName = userName;

}

public String getVerify(){

return verify;

}

publicvoid setVerify(String verify){

this.verify = verify;

}

public UserBean(String username, String password){

this.userName = username;

this.password = password;

}

@SuppressWarnings("unchecked")

public String login(){

users =getEntityManager().createNamedQuery("UserBean.findUnique").setParameter("userName", getUserName()).setParameter("password", getPassword()).getResultList();

if (users.size() == 0){

FacesContext facesContext = FacesContext.getCurrentInstance();

FacesMessage facesMessage =new FacesMessage("You have entered an invalid user name and/or password");

facesContext.addMessage("loginForm", facesMessage);

return"failure";

}else{

return"success";

}

}

public EntityManager getEntityManager()throws PersistenceException{

EntityManager entityManager = getEntityManagerFactory().createEntityManager();

try{

if (entityManager ==null){

log.fine("Opening new EntityManager for this bean ...");

entityManager = getEntityManagerFactory().createEntityManager();

}

}catch (PersistenceException ex){

thrownew PersistenceException(ex);

}

return entityManager;

}

public EntityManagerFactory getEntityManagerFactory(){

return Persistence.createEntityManagerFactory("shoppingcart");

}

}

The the stack trace says :

SEVERE: Servlet.service()for servlet Faces Servlet threw exception

org.apache.jasper.el.JspMethodNotFoundException: /userLogin.jsp(55,6)'#{user.login}' Method not found: com.introspect.shoppingcart.UserBean@3f5a0.login()

at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:71)

at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)

at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)

at javax.faces.component.UICommand.broadcast(UICommand.java:383)

at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)

at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)

at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)

at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)

at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:11

And yet I do have the login()

method in my class and its public.Whats going on?

[8269 byte] By [jmutonhoa] at [2007-11-27 10:27:27]
# 1

You could;

1. Check if user bean is mapped in faces-config.xml

2.rename the login method to something like doLogin(). I had a similar problem with a String mCardNumber;

.

hope this helps,

Dilip

dilip_jsfa at 2007-7-28 17:45:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Please post the relevant portion of the faces-config.xml

RaymondDeCampoa at 2007-7-28 17:45:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...