You're performing search by POST which is not idempotent/bookmarkable. Do like as Google, use GET instead of POST. The <f:viewParam>
is very helpful in this. Here's a kickoff example:
<f:metadata>
<f:viewParam id="query" name="query" value="#{bean.query}" />
<f:event type="preRenderView" listener="#{bean.search}" />
</f:metadata>
...
<form>
<label for="query">Query</label>
<input type="text" name="query" value="#{param.query}" />
<input type="submit" value="Search" />
<h:message for="query" />
</form>
...
<h:dataTable value="#{bean.results}" var="result" rendered="#{not empty bean.results}">
...
</h:dataTable>
With basically this @RequestScoped
bean:
private String query;
private List<Result> results;
public void search() {
results = service.search(query);
}
When the form is submitted, you end up getting the search query string in URL, making it idempotent/bookmarkable. Refreshing the request would end up in exactly the same result.