tags:

views:

16

answers:

1

hi guys , i want to implement a small search engine , i have index page where user enter search keyword then he redirected to search results page so how to display the search results since they are dynamically generated i am using lucene and i have this page implemented in jsp (i want to redesign it in jsf) :

<p style=" color: green"> <%=Srchr.HitsCount() %> Searching result(s) for :  <%= SearchText %>
<p>------------------------------------------------------------------
<% for (int i = 0 ; i<Srchr.HitsCount() ; i++){ %>
     <p> <%= (i+1) %> : <a href=   <%= Srchr.getHits()[i]  %> > <%= Srchr.getHits()[i] %> </a>

where srchr is the searcher class that access lucene db.

please help me .

thanks

+2  A: 
  1. have your search button on the home page be

    <h:commandButton action="#{searchBean.search}" value="Search" />
    
  2. Let the public String search() method fill the search results into a property of the bean (for example, List<SearchResult>)

  3. Return "searchResults" from the method, which is defined as a navigation outcome in faces-config.xml, and forwards to the searchResults.jsp

  4. Use <h:dataTable value="#{searchBean.results} var="result" to show the results

Bozho