0

I want to rewrite part of the code using composite component.

I need to instead this:

<ui:fragment rendered="#{!empty param.vid}">
<h:link outcome="index" value="#{msgs.vendor_tabmenu_profile}" 
        styleClass="#{(param.pg == 'profile') ? 'selected' : ''}">
    <f:param name="pg" value="profile"/>
    <f:param name="vid" value="#{param.vid}"/>
</h:link>
<h:link outcome="index" value="#{msgs.vendor_tabmenu_orders}" 
        styleClass="#{(param.pg == 'orders') ? 'selected' : ''}">
     <f:param name="pg" value="orders"/>
     <f:param name="vid" value="#{param.vid}"/>
</h:link>
....

somethink like this:

<components:vmtab outPage="index"
                                  value="#{msgs.vendor_tabmenu_search}"
                                  withParam="false"
                                  pg="" 
                                  vid=""
                                  selectedClass="#{( (empty param.pg) || 
                                      (param.pg == 'search') || 
                                      (param.pg == 'index') ) ? 'selected' : ''}"
                />

with:

<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface>
        <composite:attribute name="outPage" required="true"/>
        <composite:attribute name="withParam" required="true"/>
        <composite:attribute name="pg" required="true"/>
        <composite:attribute name="vid" required="true"/>
        <composite:attribute name="value" required="true"/>
        <composite:attribute name="selectedClass" />
        <composite:attribute name="styleClass" />
    </composite:interface>

    <composite:implementation>
        <h:link 
            outcome="#{composite.attrs.outPage}"
            value="#{composite.attrs.value}"
            styleClass="#{''.concat((!empty composite.attrs.styleClass ? composite.attrs.styleClass : '')).concat(
                           (!empty composite.attrs.selectedClass ? composite.attrs.selectedClass : ''))}"
            >
            <f:param name="pg" value="#{composite.attrs.pg}" 
                     rendered="#{composite.attrs.withParam}"/>
            <f:param name="vid" value="#{composite.attrs.vid}"
                     rendered="#{composite.attrs.withParam}"/>
        </h:link>
    </composite:implementation>
</html>

But i have a trouble. JSF says me: This link is disabled because a navigation case could not be matched

Please explain what I'm doing wrong.

UPD:

Thanks for your attention. Sorry. Found the problem. The root of evil, as often happens, inattention. I thought that if I wrote in XML composite namespace I had to use it. But the EL is used object named cc.

PS: I dont know how to close or delete.. or what should I do with this question ?

0 Answers0