I'm trying to execute a query to a mySQL database through Hibernate, for that I've developed a simple JSF page to introduce two words and search by these fields, but when I try to execute the method which make the query, I go an exception: javax.el.MethodNotFoundException
Here is the JSF page:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Plans search</title>
</h:head>
<h:body>
<h3>Plan Search</h3>
<h:form>
<h:selectOneRadio id="searchBy" value="#{myController.searchBy}">
<f:selectItem itemLabel="By User" itemValue="User Name"></f:selectItem>
<f:selectItem itemLabel="By Plan" itemValue="Plan Name"></f:selectItem>
</h:selectOneRadio>
<h:inputText label="Name" id="name" value="#{myController.name}"></h:inputText>
<h:inputText label="Surname" id="surname" value="#{myController.surname}"></h:inputText>
<h:commandButton id="search" type="submit" value="Search" action="#{myController.userPlans}"></h:commandButton>
</h:form>
<div><h:outputText value="#{myController.name} was invited to the following plans"></h:outputText></div>
<h:dataTable id="plansid" value="#{myController.userPlans}" var="plans" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
<h:column>
<f:facet name="header">
<h:outputText value="Plans Name"></h:outputText>
</f:facet>
<h:outputText value="#{plans.planName}"></h:outputText>
</h:column>
</h:dataTable>
</h:body>
and the code for myController is:
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@ManagedBean
@SessionScoped
public class MyController {
MyHelper helper;
DataModel listUSer;
private DataModel userPlans;
private String name;
private String surname;
Users user;
private String searchBy;
/**
* Creates a new instance of myController
*/
public MyController() {
helper = new MyHelper();
}
public MyController(String name, String surname) {
helper = new FeverHelper();
this.name = name;
this.surname = surname;
}
void recreateModel() {
setUserPlans(null);
}
/**
* @return the searchBy
*/
public String getSearchBy() {
return searchBy;
}
/**
* @param searchBy the searchBy to set
*/
public void setSearchBy(String searchBy) {
this.searchBy = searchBy;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the surname
*/
public String getSurname() {
return surname;
}
/**
* @param surname the surname to set
*/
public void setSurname(String surname) {
this.surname = surname;
}
/**
* @return the userPlans
*/
public DataModel getUserPlans() {
if (userPlans == null) {
setUserPlans(new ListDataModel(helper.getUserPlans(getName(), getSurname())));
}
return userPlans;
}
/**
* @param userPlans the userPlans to set
*/
public void setUserPlans(DataModel userPlans) {
this.userPlans = userPlans;
}
}
Appareantly is well defined, isn't it?
I'm just working over the index.xhtml file, without templates, or other padding stuff.
Thanks in advance.