Search code examples
jsfrichfacestoolbar

Show new empty page after clicking toolbar option


I have a page that is shown when something is deleted from the database. This page has a toolbar with an option to go to a page called SearchDocument, but when I click that option, the SearchDocument inputtexts aren't empty. I'd like to show a new empty page each time I click the option on the toolbar.

How could I do that?

Deleted.xhtml

 <h:body>
       <h:form>  
       <rich:toolbar height="35" >
       <rich:dropDownMenu>      
       <f:facet name="label">
       <h:panelGroup>
       <h:outputText value="Home"  style="font-size:10pt"  />
       </h:panelGroup>
       </f:facet>
       <rich:menuItem mode="ajax" label="Go" action="SearchDocument">
       </rich:menuItem>
       </rich:dropDownMenu>
       </rich:toolbar>  

       <br />
       <br />
       <h:outputText value="Successfully deleted!!!" />      

       </h:form>
       </h:body>

SearchDocument.xhtml

<h:form enctype="multipart/form-data">
 Search Documents<br />
  <br />
 <h:panelGrid columns="2">
     Title: <h:inputText value="#{pesquisaBean.title}" /> 
     <h:commandButton value="Procurar" action="#{pesquisaBean.search()}" />
   </h:panelGrid>
   <br />
  <h:panelGrid columns="2">
     Keyword: <h:inputText value="#{pesquisaBean.subject}" /> 
     <h:commandButton value="Procurar" action="#{pesquisaBean.searchBySubject()}" />
  </h:panelGrid>

    <br />
    <br />
 </form>

Solution

  • You can
    1) change action in menu item to perquisaBean.showSearchDocument and clean up title and subject in this method;
    or
    2) use other Form bean for storing data like title and subject.