i have multiple search forms, for five different databases (tables)
each form contains about 30 – 40 search fields, which can be filled.
I need all Params as GET-Params (because of SEO – for pagination)
how can i submit them and get them without define 200 entrys in the .xhtml file
(i think, to get them with facesContext is the way, how to recieve them)
thanks !
Without
<f:viewParam>, they are available byExternalContext#getRequestParameterMap(). If the bean in question is request scoped, you can also use@ManagedProperty("#{param.name}")on the property declaration instead. You can only at earliest access them in a@PostConstructmethod instead of the constructor. You’d also still need setters for them.Note that you lose JSF-builtin conversion and validation this way. You’d need to do all conversion from
Stringto for exampleIntegerand do all validation on required parameters yourself instead of letting<f:viewParam>do its job.See also:
Unrelated to the concrete problem, 200 parameters are pretty a lot. Even GET query strings have its limits. Does the view contain 50 conditionally rendered/included tables or so? Are you sure that you can’t reuse a parameter for multiple purposes and have one common parameter which indicates how the other parameters have to be interpreted?