I use Pretty Faces and JSF 2.
I have a selectOneMenu to choose a value. I want then to pass the selected value to a second form with a command button to pass then to an another page. I don't want to see the parameter in the URL.
I don't want the url as this : addpartipant.xhtml, or addparticipant.xhtml?study_name=TEST or /Addparticpant/New/TEST.
I want the URL like this only /Addparticipant/New but if I do this , I don't get to retrieve the good parameter value, I'm only retrieving the value set by default in the bean for the parameter, not the page refreshed value.
More disturbing, I have a button who appears when i change the default value in the page.And it works but it looks like the bean value of parameter is not impact and still stay at default.
How should I to that? Thank for help. I tried so listener in ajax call to set the value param in bean but it's actually not working?
/* Form which throws an ajax event when you change the value of the selectOneMenu to add the value as a parameter to a second form */
<h:form id="studySelection_form">
<h:outputText value="Sélection de l'étude :"/>
<h:selectOneMenu id="study"
value="#{home.study_name}"
required="true"
requiredMesage="Selectionnez au moins une étude.">
<f:selectItems value="#{home.studyNameItems}"
var="c"
itemLabel="#{c.studyNameLabel}"
itemValue="#{c.studyNameValue}" />
<f:ajax execute="study"
render=":add_form"
event="change"
listener="#{home.updateStudyname}"/>
</h:selectOneMenu>
</h:form>
/* Second form where the parameter to pass is injected from an ajax call from a move event from the form below */
<h:commandButton value="Ajout"
type="button"
action="pretty:participant"
rendered="#{home.study_name ne '-----'}" >
<f:param name="theNameofTheStudy"
value="#{home.study_name}" />
</h:commandButton>
PrettyFaces Config File :
<url-mapping id="participant">
<pattern value="/Participant/New/" />
<view-id value="/addParticipant.xhtml" />
</url-mapping>
Page Result addParticipant.xhtml:
<h:outputFormat value="Print : {0}, {1} ">
<f:param value="#{home.study_name}" />
<f:param value=" #{theNameofTheStudy}" />
</h:outputFormat>