Struts, menu and navigation

S

ShadowMan

hi all,
I'm using Struts + Tiles framework and I'm facing a little problem with
layouts...

I use a simple layout with horizontal tabbed menu (sections) and a
left-vertical submenu (actions).
Some of these menus couldn't exist depending on user profile.
I would synchronize _selected_ tab-menu with vertical menu wich taglib /
default layout / navigation-system package do you suggest for this purpose?!
Now I'm trying with first step using static menu defined inside
tiles-definition.xml and I'm encountering troubles passing attributes to
nested tiles...

Any hint?
 
M

Muz

Shadowman,
There are 2 approaches to this:

1. Make all of your horizontal tabs launch separate struts modules (or
even separate webapps), each one having
it's own left-menu/body-content parts. They could all share the same
horizontal menu tile. Some smart ANT build file
could

2. Write your own taglib to conditionally handle the left menu based
on a value in the user's session (and/or
which horizontal menu item was selected). Take a look at the tiles
example tabs layout for hints to this.

e.g.:

tiles-defs.xml:
<definition name=".tablayout.base"
path="/jsp/layouts/nestedTabsLayout.jsp">
<put name="selectedIndex" value="0" />
<put name="parameterName" value="tabselected" />
<putList name="tabList">
<item value="Tab 1" link="/jsp/tab1.jsp" />
<item value="Tab 2" link="/jsp/tab2.jsp" />
<item value="Tab 3" link="/jsp/tab3.jsp" />
</putList>
</definition>


nestedTabsLayout.jsp:
<tiles:useAttribute name="parameterName" classname="java.lang.String"
/>
<tiles:useAttribute id="selectedIndexStr" name="selectedIndex"
ignore="true" classname="java.lang.String" />
<tiles:useAttribute name="tabList" classname="java.util.List" />

<%
session.setAttribute( parameterName , new
Integer(selectedIndexStr) );
%>

<logic:iterate id="tab" name="tabList"
type="org.apache.struts.tiles.beans.MenuItem" >
<myusertag:hasRoleFor parm1="<%=tab.getValue()%>"
parm2="<%=selectedIndexStr%>">
....
</myusertag:hasRoleFor>
</logic:iterate>


hope that helps
Muz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top