3

I have a problem with passing parameters with h:link

<h:link id="partyname" outcome="memberlist" value="memberlist">
    <f:param  name="partyname" value="#{partyBean.currentparty.name}" /> 
</h:link>

but when i click on the link the url generated is simply the follow:

http://localhost:8080/DigitalStateSWProjectWeb/memberlist.xhtml;jsessionid=29a181ab1a3170496ca9b0200f52

The main problem is also that i am sure that

#{partyBean.currentparty.name}

is a correct code and it is generating the correct string.. I'd like that my generated URL is somethink like:

http://localhost:8080/DigitalStateSWProjectWeb/memberlist.xhtml?partyname=Yellow

Thanks in advance for your answers.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Sam
  • 313
  • 4
  • 21

1 Answers1

2

Just add metadata between <h:head> and <h:body> tags. It will solve your problem.

<f:metadata>
    <f:viewParam name="partyname" value="#{partyBean.currentparty.name}"/>
</f:metadata>

And add xmlns:f="http://java.sun.com/jsf/core to the <ui:fragment> for recognition metadata

<ui:fragment xmlns:f="http://java.sun.com/jsf/core">
user3127896
  • 6,323
  • 15
  • 39
  • 65
  • Sorry, just another small question... if I have now my h:link in each row of a given dataTable, and so my param is changing for each row, how can i set my f:metatada ?!?!? I have to know the "itaration" object on the table... – Sam May 25 '14 at 14:06
  • take a look a this topic, http://stackoverflow.com/questions/6377798/what-can-fmetadata-and-fviewparam-be-used-for , here is a clear explanation – user3127896 May 25 '14 at 14:11