- they are not added to the rendered link. I am using Mojarra 2." /> - they are not added to the rendered link. I am using Mojarra 2." /> - they are not added to the rendered link. I am using Mojarra 2."/>

Include view parameters in h:link

85 Views Asked by At

I have a problem when adding view parameters to a <h:link includeViewParams="true" /> - they are not added to the rendered link. I am using Mojarra 2.3.9.

  • Template /WEB-INF/templates/main.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head>
  <!-- Some headers -->
</h:head>

<h:body>
    <f:view>
        <ui:insert name="metaContent" />
        <div class="container-fluid" id="mainContent">
            <ui:insert name="mainContent" />
        </div>
    </f:view>
</h:body>
</html> 
  • Template being used on page test.xhtml
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:o="http://omnifaces.org/ui"
    template="/WEB-INF/templates/main.xhtml">

    <ui:define name="metaContent">
        <f:metadata>
            <f:viewParam name="id" value="#{myBean.obj}" required="true">
                <f:validator validatorId="myIdVvalidator" />
                <f:converter converterId="myConverter" />
            </f:viewParam>
        </f:metadata>
    </ui:define>

    <ui:define name="mainContent">
        <!-- Simply reference current page -->
        <h:link outcome="test.xhtml" includeViewParams="true">
          My link
        </h:link>
    </ui:define>
</ui:composition>

Update

If I remove the attribute value of f:viewParam as well as the f:converterand f:validator child elements, the link is rendered as expected. Why can this cause a problem? The Bean myBean is @RequestScoped

0

There are 0 best solutions below