Pass param via h:link using bean with the same view scope( has a value of null and thus will not be added to the URL)
jsf, jsf-2, primefaces, selectonemenu
Solution
The `<f:xxx>` tags like `<f:param>` doesn't generate any HTML and thus have nothing to update in the HTML DOM tree on ajax request. The `<h:xxx>` components are the ones which generate HTML and are updatable in the HTML DOM tree on ajax request. You need to update the `<h:link>` component instead of the `<f:param>` tag. So, move that `id` from `<f:param>` to `<h:link>`.
<h:link id="testId" value="Add new question" outcome="addQuestion">
<f:param name="testId" value="#{addQuestion.test.testIdentifer.testId}"/>
</h:link>
Problem
I have one bean with view scope and want pass parametr between two different pages and on first page before this link I have `<p:selectOneMenu/>` where I choose test which id should be pass as GET param ``` <p:selectOneMenu value="#{addQuestion.test}" id="tests" converter="#{testConverter}" required="true" requiredMessage="Please, choose test"> <f:selectItem itemLabel="--Select a test--" itemValue="" /> <f:selectItems value="#{addQuestion.testList}" var="testItem" itemValue="#{testItem}" itemLabel="#{testItem.testName}" /> <p:ajax process="@this" listener="#{addQuestion.getQuestionsBySubject()}" update="addingQuestionsTable, testId" /> </p:selectOneMenu> <h:link value="Add new question" outcome="addQuestion"> <f:param id="testId" name="testId" value="#{addQuestion.test.testIdentifer.testId}"/> </h:link> ``` //in second page ``` <f:metadata> <f:viewParam name="testId" value="#{addQuestion.test.testIdentifer.testId}" converter="#{testConverter}" required="true" requiredMessage="Invalid page access. Please use a link from within the system."/> </f:metadata> ``` And bean ``` @ManagedBean(name = "addQuestion") @ViewScoped public class AddQuestion implements Serializable { private Test test; //get //set } ``` But when I try to get value on second page I nothing to get in expression `#{addQuestion.test.testIdentifer.testId}"` And also in development mode I get has a value of null and thus will not be added to the URL. My `#{testConverter}` is managed bean in view scope. How I can pass testId in one bean with view scope and why I get this error?