The bean (quite similar to "HotelSearchAction in booking example"):
import java.util.List; | import javax.ejb.Remove; | import javax.ejb.Stateful; | import javax.persistence.EntityManager; | import javax.persistence.PersistenceContext; | import org.jboss.seam.ScopeType; | import org.jboss.seam.annotations.Destroy; | import org.jboss.seam.annotations.Factory; | import org.jboss.seam.annotations.Name; | import org.jboss.seam.annotations.Scope; | import org.jboss.seam.annotations.datamodel.DataModel; | import org.jboss.seam.annotations.security.Restrict; | | @Stateful | @Name("partSearch") | @Scope(ScopeType.SESSION) | //@Restrict("#{identity.loggedIn}") | public class PartSearchAction implements PartSearch | { | | @PersistenceContext | private EntityManager em; | | private String searchString; | private int pageSize = 10; | private int page; | | @DataModel | private List<PartCMP> parts; | | //------------------------------------------------------------------------------------- | // | | private void doSearch() | { | parts = em.createQuery("select p from PartCMP p where partnumber like #{pattern}") | .setMaxResults(pageSize) | .setFirstResult( page * pageSize ) | .getResultList(); | } | | //------------------------------------------------------------------------------------- | // | public void findParts() | { | page = 0; | doSearch(); | //return("main"); | } | | //------------------------------------------------------------------------------------- | // | public int getPageSize() | { | return(pageSize); | } | | //------------------------------------------------------------------------------------- | // | public String getSearchString() | { | return(searchString); | } | | //------------------------------------------------------------------------------------- | // | public boolean isNextPageAvailable() | { | return(parts!=null && parts.size()==pageSize); | } | //------------------------------------------------------------------------------------- | // | public void nextPage() | { | page++; | doSearch(); | } | //------------------------------------------------------------------------------------- | // | public void setPageSize(int pageSize) | { | this.pageSize = pageSize; | } | | //------------------------------------------------------------------------------------- | // | public void setSearchString(String searchString) | { | this.searchString = searchString; | } | | //------------------------------------------------------------------------------------- | // | @Factory(value="pattern", scope=ScopeType.EVENT) | public String getSearchPattern() | { | return(searchString==null ? "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%'); | } | | //------------------------------------------------------------------------------------- | // | @Destroy @Remove | public void destroy() | {} | | } | xhtml form : <h:form id="searchCriteria"> | <fieldset> | <h:inputText id="searchString" value="#{partSearch.searchString}" style="width: 165px;"> | </h:inputText> | | <a:commandButton id="findPartsBtn" value="Find part" action="#{partSearch.findParts}" reRender="searchResults"/> | <a:status> | <f:facet name="start"> | <h:graphicImage value="/img/spinner.gif"/> | </f:facet> | </a:status> | <br/> | <h:outputLabel for="pageSize">Maximum results:</h:outputLabel> | <h:selectOneMenu value="#{partSearch.pageSize}" id="pageSize"> | <f:selectItem itemLabel="5" itemValue="5"/> | <f:selectItem itemLabel="10" itemValue="10"/> | <f:selectItem itemLabel="20" itemValue="20"/> | </h:selectOneMenu> | </fieldset> | </h:form> | When I comment the link to #{partSearch.findParts} (command button code), page is displayed fine , although calls to other partSearch methods exist in this page. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055700#4055700 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055700 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user