Like I said, it is possible to do this with Struts Menu, but you have
to use the Velocity Displayer for control of the server-side code.
With the regular JSP tags, you'd still have to have some sort of
indicator from the page on which menu to select.  Maybe this could be
a JSTL-set variable, but it'd still have to be set, unless some Ajax
call occurred when you clicked on a link and a filter was responsible
for setting the variable.  Here's how I do it with Velocity menus and
SiteMesh.

http://raibledesigns.com/page/rd?entry=dependency_injection_with_sitemesh

Matt

On 11/8/06, Seamus O'Brien <[EMAIL PROTECTED]> wrote:
> Hi Matt,
>   thanks for the response and the advice. I played around with tabs.js and
> could see that it couldn't find a matching url so therefore didn't highlight
> any menu tabs, so i did some hackery and hardcoded the urls of my other
> pages into it. quite ugle i suppose but it works.
>
>   i have to admit i thought that struts-menu would have been able to take
> care of this, ie i was expecting attributes in the menu-config.xml file that
> would allow one to map multiple urls/struts actions to specific menu tabs,
> thus removing any dependence on javascript. perhaps in the next version.
> thanks and regards
> sham
>
>
>
> >From: "Matt Raible" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED],General mailing list for Struts Menu
> ><[email protected]>
> >To: "General mailing list for Struts Menu"
> ><[email protected]>
> >Subject: Re: [struts-menu] 2 basic struts-menu-2.4.2 problems -keep
> >activetab selected & select inital ta
> >Date: Tue, 7 Nov 2006 11:24:52 -0700
> >
> >If you look in the JavaScript for this menu system, you can see the
> >logic that's used.  Basically, it tries to match based on URL, and
> >then uses cookies if that doesn't work.  The cookie is set when you
> >click on a menu.  It's somewhat fragile - you may be able to use a
> >Velocity-based menu and put some logic in there to set the CSS class
> >at rendering time, rather than post-rendering with JavaScript.
> >
> >Matt
> >
> >On 11/7/06, Seamus O'Brien <[EMAIL PROTECTED]> wrote:
> > > Hi there,
> > >   I've just started integrating tiles and struts menu
> >(struts-menu-2.4.2)
> > > and I was able to get the horizontal TabbedMenu working with my tiles
> >(looks
> > > good!). There are 2 basic problems I'm having still, they are:
> > >
> > > * how to keep a specific tab active
> > > * how do I select a tab to be initially selected when the web page is
> >first
> > > accessed?
> > >
> > > There does not seem to be a lot of documentation regarding the MenuBase
> > > class attributes, but I assume the answer must be using the "location"
> > > attribute? I can't seem to get anything to work though.
> > >
> > > Here is my code:
> > >
> > > ---template.jsp---:
> > > <menu:useMenuDisplayer name="TabbedMenu"
> > > bundle="org.apache.struts.action.MESSAGE">
> > >   <menu:displayMenu name="reports"/>
> > >   <menu:displayMenu name="products"/>
> > >   <menu:displayMenu name="settings"/>
> > > </menu:useMenuDisplayer>
> > >
> > > <tiles:insert attribute="body"/>
> > >
> > >
> > > --Tiles defintion.xml--:
> > > <tiles-definitions>
> > >   <definition name=".templateDefinition" path="/template.jsp">
> > >     <put name="title" type="string" value="Welcome"/>
> > >     <put name="header"  value="topFrame.html" type="page"/>
> > >     <put name="menu" value="menu.jsp" type="page"/>
> > >   </definition>
> > >
> > >   <definition name=".reports" extends=".templateDefinition">
> > >      <put name="title" type="string" value="Reports"/>
> > >      <put name="body" value="/reports.jsp" type="page"/>
> > >   </definition>
> > >
> > >   <definition name=".products" extends=".templateDefinition">
> > >     <put name="title" type="string" value="Products"/>
> > >     <put name="body" value="/products.jsp" type="page"/>
> > >   </definition>
> > >
> > >   <definition name=".settings" extends=".templateDefinition">
> > >     <put name="title" type="string" value="Settings"/>
> > >     <put name="body" value="/settings.jsp" type="page"/>
> > >   </definition>
> > > </tiles-definitions>
> > >
> > >
> > > --menu-config.xml--:
> > > <MenuConfig>
> > >   <Menus>
> > >     <Menu name="reports" title="Reports" action="/reports"/>
> > >     <Menu name="products" title="Products" action="/products"/>
> > >     <Menu name="settings" title="Settings" action="/settings"/>
> > >   </Menus>
> > > </MenuConfig>
> > >
> > >
> > > --struts-config.xml--:
> > > <action
> > >   path="/reports"
> > >   forward=".reports">
> > > </action>
> > > <action
> > >   path="/products"
> > >   forward=".products">
> > > </action>
> > > <action
> > >   path="/settings"
> > >   forward=".settings">
> > > </action>
> > >
> > > The Reports & Products pages have links to other pages that I still want
> >to
> > > remain shown under the "Reports" or "Products" active tab, ie I have
> > > showOldReports and showNewReports links under the Reports.jsp/Reports
> >tab,
> > > and a showOldProducts and showNewProducts links under the
> > > Products.jsp/Products tab. Or to explain more simply - how can I link
> >the
> > > result several struts .do actions to a single menu tab, or even more
> >simply
> > > - several tiles definitions to a single tab menu. Does anyone know how
> >to do
> > > this? I have seen some posts about using javascript but that was back in
> > > 2003 and I imagine that this has been made much easier to do now, right?
> >The
> > > other question then is how to initally select a tab, eg the second tab
> >in
> > > the list?
> > >
> > > Thanks for any help
> > > Rory
> > >
> > > _________________________________________________________________
> > > Discover the magic of RSS feeds at MSN Ireland! http://ie.msn.com/
> > >
> > >
> > >
> >-------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services,
> >security?
> > > Get stuff done quickly with pre-integrated technology to make your job
> >easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> >Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > struts-menu-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/struts-menu-user
> > >
> >
> >
> >--
> >http://raibledesigns.com
> >
> >-------------------------------------------------------------------------
> >Using Tomcat but need to do more? Need to support web services, security?
> >Get stuff done quickly with pre-integrated technology to make your job
> >easier
> >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >_______________________________________________
> >struts-menu-user mailing list
> >[email protected]
> >https://lists.sourceforge.net/lists/listinfo/struts-menu-user
>
> _________________________________________________________________
> Find accommodation FAST with MSN Search! http://search.msn.ie/
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> struts-menu-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/struts-menu-user
>


-- 
http://raibledesigns.com

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
struts-menu-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/struts-menu-user

Reply via email to