2

can anyone tell me why the viewparams are not included? i can't figure out why...

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"> 

    <h:head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </h:head>

    <f:metadata>
        <f:viewParam name="id" value="#{bean.id}" required="true"/>
        <f:viewParam name="name" value="#{bean.name}" required="true"/>
    </f:metadata>

    <h:body>

        <h:link includeViewParams="true" outcome="extendedAccess/pagex">
            <h:graphicImage value="../resources/images/img.png" style="width:120px; height:120px;" />
        </h:link>

    </h:body>
</html>

The bean is OK, it has the required getters/setters. I don't want to copy and paste f:param-tags to every link when there is the opportinity to use viewparams... I even tested it with ?includeViewParams=true

is the project corrupt or what is wrong?

Niko
  • 1,024
  • 4
  • 24
  • 50

1 Answers1

1

The target view (the page behind <h:link outcome>) must also have those view parameters definied by <f:viewParam>. If it doesn't have them definied, then they won't be included by includeViewParams in the calling view.

See also:

Community
  • 1
  • 1
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452