Geek
Geek

Reputation: 27219

How does the request parameters gets created for GET requests in JSF?

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 ?

Upvotes: 0

Views: 138

Answers (1)

BalusC
BalusC

Reputation: 1109745

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:

Upvotes: 1

Related Questions