0

This question is influenced by this answer by Balus C on the topic of f:viewParam . He writes in his answer that the first thing done by the the following code will "get the request parameter value by name id".

<f:metadata>
    <f:viewParam name="id" value="#{bean.id}" />
</f:metadata>

I understand that this feature is used in conjunction with GET requests but I fail to understand how the request parameter with the name "id" gets created in the very first place ?Also if I understood correctly "f:viewParam" goes hand in hand with the special includeViewParams query parameter for implicit navigation . Which of these two features is actually responsible for creating the request parameter ? Or is it none of these two ?

Community
  • 1
  • 1
Geek
  • 23,609
  • 39
  • 133
  • 212

1 Answers1

1

It's just part of standard HTTP. To pass a request parameter with name id, you'd basically need to have a link like follows

/view.xhtml?id=42

Such an URL is usually already provided elsewhere in your webapp. E.g.

<h:link value="View details of item with ID #{item.id}" outcome="view">
    <f:param name="id" value="#{item.id}" />
</h:link>

See also:

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452