Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<h:link includeViewParams="true"> does not include URL parameters

Tags:

jsf

viewparams

I have a JSF page which is opened by an URL like test.xhtml?a=15&b=20.

I have a link which should pass all URL parameters to the next page.

<h:link outcome="index" includeViewParams="true" value="Include all url parameters" />

I was expecting that when I click on the link it will go to index.xhtml?a=15&b=20

But I don't see anything in the URL. Did I understand the includeViewParams wrong?

like image 716
user373201 Avatar asked Dec 08 '25 14:12

user373201


1 Answers

The includeViewParams will include all <f:viewParam> values. You however don't seem to have declared them.

Declare them accordingly in the template client.

<f:metadata>
    <f:viewParam name="a" />
    <f:viewParam name="b" />
</f:metadata>

Note that binding the value to bean property as in <f:viewParam name="a" value="#{bean.a}" /> is optional. The view parameters in the example are available in the EL scope by #{a} and #{b}.

See also:

  • What can <f:metadata>, <f:viewParam> and <f:viewAction> be used for?
  • ViewParam vs @ManagedProperty(value = "#{param.id}")
like image 78
BalusC Avatar answered Dec 12 '25 00:12

BalusC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!