7.3. Page parameters
A Faces request (a JSF form submission) encapsulates both an action (a method binding) and parameters (input value bindings). A page action can also require parameters.
Since non-Faces (GET) requests can be bookmarked, page parameters are passed as human-readable request parameters.
You can use page parameters with or without an action method.
7.3.1. Mapping request parameters to the model
Seam lets us provide a value binding that maps a named request parameter to an attribute of a model object.
<pages> <page view-id="/hello.jsp" action="#{helloWorld.sayHello}"> <param name="firstName" value="#{person.firstName}"/> <param name="lastName" value="#{person.lastName}"/> </page> </pages>
The
<param>
declaration is bidirectional, as with value bindings for JSF input:
- When a non-Faces (GET) request for the view ID occurs, Seam sets the value of the named request parameter to the model object, after performing appropriate type conversions.
- Any
<s:link>
or<s:button>
includes the request parameter transparently. The parameter value is determined by evaluating the value binding during the render phase (when the<s:link>
is rendered). - Any navigation rule with a
<redirect/>
to the view ID includes the request parameter transparently. The parameter value is determined by evaluating the value binding at the end of the invoke application phase. - The value is transparently propagated with any JSF form submission for the page with the given view ID. This means that view parameters behave like
PAGE
-scoped context variables for Faces requests.
However we arrive at
/hello.jsp
, the value of the model attribute referenced in the value binding is held in memory, without the need for a conversation (or other server-side state).