<definition name=".layout.basic-cd" path="/pages/cd/layout/basicTemplate.jsp">
<put name="topleft" value="/pages/cd/content/common/topleft.jsp" />
<put name="header" value="/pages/cd/content/common/logged-in-header.jsp" />
<put name="menu" value="/pages/cd/content/common/menu.jsp" />
<put name="bottomleft" value="/pages/cd/content/common/bottomleft.jsp" />
<put name="footer" value="/pages/cd/content/common/footer.jsp" />
</definition>
<definition name=".page.main" extends=".layout.basic-cd"> <put name="content" value="/pages/cd/content/main.jsp"/> </definition>
...
then, in menu.jsp page I include either "admin" menu or "user" menu based on the session parameter:
<unstandard:bind var="AdminRole" type="cd.business.Role" field="ADMIN"/> <unstandard:bind var="UserRole" type="cd.business.Role" field="USER"/> <c:choose> <c:when test="${sessionScope.role == AdminRole}"> <tiles:insert page="menu-admin.jsp" /> </c:when> <c:when test="${sessionScope.role == UserRole}"> <tiles:insert page="menu-user.jsp" /> </c:when> </c:choose>
Now the question: is this the "proper" way to do this, or is there a more elegant method?
PS. if those <unstandard:bind> tags confuse, they use jakarta unstandard taglib to enable JSTL to compare the object in session to typesafe enumeration values. In scriptlets this would be written simply as
<% if (cd.business.Role.ADMIN.equals(session.getAttribute("role")) { %> <tiles:insert page="menu-admin.jsp" /> ...
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]