Pregunta

I have 4 different types of members in my website lets say memberA, memberB, memberC, and memberD. Each should have its own header headerA.jsp, headerB.jsp, headerC.jsp, headerD.jsp.

As shown below, there is a definition for each Member type and their specific header and body are defined. Each has its own header but some of them for example memberA, memberB and memberC share gbody.jsp as their body attribute.

     <definition name="MemberA" extends="baseLayout">
            <put-attribute name="header" value="/headerA.jsp"/>
            <put-attribute name="body" value="/gbody.jsp"/>
        </definition>

       <definition name="MemberB" extends="baseLayout">
            <put-attribute name="header" value="/headerB.jsp"/>
            <put-attribute name="body" value="/bodyB.jsp"/>
        </definition>

        <definition name="MemberC" extends="baseLayout">
            <put-attribute name="header" value="/headerC.jsp"/>
            <put-attribute name="body" value="/gbody.jsp"/>
        </definition>

        <definition name="MemberD" extends="baseLayout">
            <put-attribute name="header" value="/headerD.jsp"/>
            <put-attribute name="body" value="/gbody.jsp"/>
        </definition>

I have two problems when the member is signed in

  1. How do I show them their specific header?
  2. How do I define their specific body attribute?
¿Fue útil?

Solución

You could define the 4 headers as such

<definition name="Members" extends="baseLayout">
    <put-attribute name="headerA" value="/headerA.jsp"/>
    <put-attribute name="headerB" value="/headerB.jsp"/>
    <put-attribute name="headerC" value="/headerC.jsp"/>
    <put-attribute name="headerD" value="/headerD.jsp"/>
    <put-attribute name="body" value="/gbody.jsp"/>
</definition>

and then in the base layout have some code that says

<c:if test="${memberA}">
    <tiles:insert attribute="headerA"/>
</c:if>
etc...
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top