1

I have a pare which is requires a GET-paremeter (int id). is also has with some textfields (for filtering)

<h:form> 
  //some textfields
  <h:commandButton value="Anwenden" actionListener="#{bean.acceptFilters}" action="">
      <f:param name="id" value="#{bean.logbookId}" />
  </h:commandButton>
<h:form>

Now, I have two problems:

  1. I need somehow a GET-Request to allow bookmarking of the search results (like Google)
  2. The parameter "id" is also not passed in the URL when i post the form (but is required)

The parameters in the url are lost when i click submit... internally they exist.

e-sushi
  • 13,786
  • 10
  • 38
  • 57
Niko
  • 1,054
  • 5
  • 25
  • 52

1 Answers1

1

Just use a GET button instead of a POST button. Get rid of the word "command" in the component (and if necessary also the POST form if it isn't been used for other purposes).

<h:button value="Anwenden" outcome="nextpage">
    <f:param name="id" value="#{bean.logbookId}" />
</h:button>

In order to supplant the actionListener, do the job in (post)constructor or preRenderView listener of the managed bean associated with nextpage.xhtml.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Hi BalusC, thanks for your help; Is it with h:button also possible to send the text-fields' content via get-parameter? because that was the reason i used a form – Niko Sep 02 '13 at 11:39
  • No. Just use a regular `
    ` with `` instead of `` with ``.
    – BalusC Sep 02 '13 at 11:40
  • Thanks, so is this the preferred way to specify navigation? as already mentioned I'd like that the user can specify a filter, which is sent by GET to the same page to do filtering? – Niko Sep 02 '13 at 11:43
  • There is no "better" way. Just use the right tool for the job. See also the "See also" links for an elaboration on that. – BalusC Sep 02 '13 at 11:45