0 Replies Latest reply on Aug 14, 2012 5:23 PM by Wingman Boby

    how to submit searchform with form fields

    Wingman Boby Newbie

      Hi i have a serach form

      using input search fields i want to query as below...

       

      please suggest how my method should be in managed bean,  and how my method will take these fields as method parameter to filter out my data from table..

      and passing this result to result.xhtml page.

       

       

      code for  search.xhtml

       

                          <h:form>

                          <h:panelGrid  columns="2" >

                          <h:outputText value="First Name" />

                          <h:inputText value="#{sampleMBean.firstName}"/>

                          <h:outputText value="Last Name" />

                          <h:inputText value="#{sampleMBean.lastName}"/>

                          <h:commandButton value="Search" style="font-weight:bold; font-size:12pt"

                           action="#{sampleMBean.searchByUser}"></h:commandButton>

                          </h:panelGrid>

                          </h:form>

       

      and my managed bean is like

       

      public class SampleMBean {

       

      my query is like....

      select * from table  tbl where tbl.firstName =' ? ' and  tbl.firstName =' ? '  tbl.lastName =' ? '

       

      }

       

      and i want to display the results in  another page    results.xhtml

       

      Please suggest,