I am trying to construct equivalent of this code in JSF2
<form action="/search.xhtml" method="get">
<div class="search">
<input type="hidden" name="mutation" value="#{facesContext.viewRoot.locale}" />
<input name="searchString" class="text" />
<input type="submit" class="searchSubmit" value="#{msg.searchIt}" />
</div>
</form>
The point of this construction is to redirect user to the search.html page, which shows the search results. The page uses URL params to decode the searchString and language mutation.
And because it uses get, it is also bookmarkable.
With JSF2 I tried to use the h:button with param for the mutation, but I dont have a clue, how to force jsf to encode the h:inputText searchString.
Thanks for your help.
As far as I know, there is no possibility to use method=”GET” in JSF.
It is not what you exactly want, but may be using post-redirect-get pattern can solve your issue:
More about PRG pattern in JSF2 in this article: http://www.warski.org/blog/?p=185