Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <h:form id="myForm" prependId="false">
  2. <div class="input-field col s12 m7 l8">
  3. <p:inputTextarea styleClass="materialize-textarea" id="q" value="#{documentController.motSearch}"/>
  4. <label for="q">Mot/phrase à chercher</label>
  5. </div>
  6.  
  7. <p:commandButton id="bb" type="submit" value="Chercher"
  8. action="ListeDocuments?faces-redirect=true&includeViewParams=true"/>
  9.  
  10. </h:form>
  11.  
  12. <f:metadata>
  13. <f:viewParam name="searching" value="#{documentController.searching}" />
  14. <f:viewParam name="q" value="#{documentController.motSearch}"/>
  15. <f:viewAction action="#{documentController.onload}"/>
  16. </f:metadata>
  17.  
  18. <p:dataTable id="table" tableStyleClass="hoverable striped" rows="10" paginator="true"
  19. value="#{documentController.documents}" var="doc"
  20. paginatorPosition="bottom" paginatorAlwaysVisible="false" styleClass="borderless">
  21. ....
  22. </p:dataTable>
  23.  
  24. import javax.faces.bean.ManagedBean;
  25. import javax.faces.bean.SessionScoped;
  26.  
  27. @ManagedBean
  28. @SessionScoped
  29. public class DocumentController implements Serializable{
  30.  
  31. private String motSearch;
  32. private boolean searching = false;
  33. private List<Document> documents;
  34.  
  35. public void onload()
  36. {
  37. if(!searching)
  38. {
  39. motSearch = null;
  40. documentsListForConnectedUser();
  41. }
  42. else{
  43. search();
  44. }
  45. }
  46.  
  47. public void search()
  48. {
  49. // querying the database to get all the documents
  50. // filtering the documents list
  51.  
  52. }
  53.  
  54. //other methods
  55. //getters and setters
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement