Skip to content

Instantly share code, notes, and snippets.

@larissaleite
Last active March 13, 2016 23:13
Show Gist options
  • Save larissaleite/b401c672cd5e05662f7c to your computer and use it in GitHub Desktop.
Save larissaleite/b401c672cd5e05662f7c to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="templates/basic-template.xhtml">
<ui:define name="content">
<h:form id="searchForm" prependId="false">
<div class="search">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<h4>Search</h4>
<h:inputText value="#{searchBean.query}" styleClass="form-control"
id="query" type="text" name="query" maxlength="100"
placeholder="Search query" />
<hr />
<h:commandButton value="Search"
styleClass="form-control btn btn-default">
<f:ajax execute="@form" listener="#{searchBean.search}"
render="@form" />
</h:commandButton>
</div>
<div class="col-md-4"></div>
</div>
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-11">
<h:panelGroup id="searchResults" styleClass="results">
<h:panelGroup rendered="#{not empty searchBean.items}">
<p:dataTable styleClass="resultsTable" var="item"
value="#{searchBean.items}">
<p:column headerText="Id">
<h:outputText value="#{item.id}" />
</p:column>
<p:column headerText="Title">
<h:outputText value="#{item.title}" />
</p:column>
<p:column headerText="Author">
<ui:repeat var="author" value="#{item.authors}">
<h:outputText value="#{author}" />
</ui:repeat>
</p:column>
<p:column headerText="Score">
<h:outputText value="#{item.score}" />
</p:column>
<p:column headerText="">
<h:commandLink value="DL">
<p:ajax listener="#{searchBean.saveInteraction(item.id)}" />
</h:commandLink>
</p:column>
</p:dataTable>
</h:panelGroup>
</h:panelGroup>
</div>
</div>
</div>
</h:form>
</ui:define>
</ui:composition>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment