The <f:viewParam>
works as good in POST requests.
You should only keep in mind that this runs during apply request values phase only, not during render response phase. So, if you're actually navigating on an action method and expecting the parameter to be set as view parameter of the target page, then you're wrong. It will only be set on the view where the POST request is actually submitting to.
As an evidence that the <f:viewParam>
works on POST as well, here's a test snippet:
<f:metadata>
<f:viewParam name="foo" />
</f:metadata>
<h:form>
<h:commandButton value="submit">
<f:param name="foo" value="bar" />
</h:commandButton>
</h:form>
<p>foo: #{foo}</p>
Pressing the submit button will show up foo: bar
.
You need to solve your concrete functional requirement in a different manner. As you didn't tell anything about the concrete functional requirement in your question, it's not possible to give an elaborate answer on that. Here are at least some hints:
@Inject
target bean and set it as property during action method.
- Use
<f:setPropertyActionListener>
.
- Use flash scope.
- Send a redirect with parameter in query string.