Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h:form id="myForm" prependId="false">
- <div class="input-field col s12 m7 l8">
- <p:inputTextarea styleClass="materialize-textarea" id="q" value="#{documentController.motSearch}"/>
- <label for="q">Mot/phrase à chercher</label>
- </div>
- <p:commandButton id="bb" type="submit" value="Chercher"
- action="ListeDocuments?faces-redirect=true&includeViewParams=true"/>
- </h:form>
- <f:metadata>
- <f:viewParam name="searching" value="#{documentController.searching}" />
- <f:viewParam name="q" value="#{documentController.motSearch}"/>
- <f:viewAction action="#{documentController.onload}"/>
- </f:metadata>
- <p:dataTable id="table" tableStyleClass="hoverable striped" rows="10" paginator="true"
- value="#{documentController.documents}" var="doc"
- paginatorPosition="bottom" paginatorAlwaysVisible="false" styleClass="borderless">
- ....
- </p:dataTable>
- import javax.faces.bean.ManagedBean;
- import javax.faces.bean.SessionScoped;
- @ManagedBean
- @SessionScoped
- public class DocumentController implements Serializable{
- private String motSearch;
- private boolean searching = false;
- private List<Document> documents;
- public void onload()
- {
- if(!searching)
- {
- motSearch = null;
- documentsListForConnectedUser();
- }
- else{
- search();
- }
- }
- public void search()
- {
- // querying the database to get all the documents
- // filtering the documents list
- }
- //other methods
- //getters and setters
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement