0
votes

For some reason,the does not always append the view parameters to the produced link. I can't figure out why. If I change the outcome to another similar link,then it is processed correctly.

Can anyone point me to some requirement that could not be fulfilled? I didn't find anything relevant in the docs.

I am trying to set up 4 views backed by a single bean. Those views all contains the same view parameters, but only one of them process them. All view use the same template.

So i have in all views

<f:metadata>
    <f:viewParam name="param1"
                 value="#{bean.param1}"/>
    <f:viewParam name="param2"
                 value="#{bean.param2}"/>
</f:metadata>
<ui:composition template="/onpage/template.xhtml">
// ...

And in one of them, i included a <f:viewAction>

In the template I have some links

<h:link outcome="#{bean.outcome1}"
        value="Go to view1"/>
<h:link outcome="#{bean.outcome2}"
        value="Go to view2"/>

and in the bean:

private String param1; // And get/setters
private String param2; // and get/setters
public String getOutcome1() {
 return "/my/path.jsf?some=param&includeViewParams=true";
}
public String getOutcome2() {
 return "/my/path2.jsf?some=param2&includeViewParams=true";
}

With this setup, some of the links point to "/my/path.jsf?param1=value1&param2=value2" as expected, while others point to "/my/path2.jsf?some=param2" for no apparent reason, and without any information in the log.

All this running on glassfish 4/JSF 2.2/primefaces 4.

THanks

1
you mean, some of the links in the same page? or in some pages you have the parameters and in some other pages you do not? - Antonio Ragagnin
Also, have you tried adding the ` <f:param name="param1" value="#{bean.param1}"/>` inside the <h:link> ? - Antonio Ragagnin
on the same page! Im going crazy.. If i add the parameters manually, the link is correctly generated, but view params are not processed in the outcoming view - cghislai
And it also happens to link2 or sometimes o link1and sometimes to link2? - Antonio Ragagnin
This is always the same link that fails. If I replace the outcome to another one, it works. If i create an empty page with only the view param and ui:define, it fails. - cghislai

1 Answers

0
votes

Answer part of the OP comments:

What happened is that I mixed XML namespace domains. The pages using xmlns:f="java.sun.com/jsf/core were working correctly, while those using xmlns:f="xmlns.jcp.org/jsf/core were not. See The metadata component needs to be nested within a f:metadata tag. Suggestion: enclose the necessary components within <f:metadata> for more details.

Note: JSF 2.2 schemas use the xmlns:f="xmlns.jcp.org/jsf/core namespace.