sorry, didn't mean to send the email below without comment....
Well, mainmenu.xml is a static xml file representing a menu, menu.xsl is the
stylesheet that renders it (note the XSL currently only handles one level
of nesting mainly due to my lack of knowledge of XSL!). The
PortalAction.java class is a base class for all the action classes. This is
very much a first attempt and some of this logic probably belongs in a
dedicated menu manager class. A particular action calls LoadMenu with the
name of the menu it wants to load. This checks for the id parameter (which
uniquely identifies each menu option) and uses this to add the selected and
expanded attributes to the appropriate menu options.
Note this is very much an early version and it already has a major bug -
keeping the id of the selected option between requests (if something other
than a menu option is responsible for generating the action) - I'm fixing
this at the moment.
I'm fairly new to struts ( and Cocoon) so if anyone knows a better way of
doing this please let me know.
> -----Original Message-----
> From: O'Reilly John
> Sent: 20 July 2001 16:13
> To: '[EMAIL PROTECTED]'
> Subject: RE: Tree
>
> <<mainmenu.xml>> <<menu.xsl>> <<PortalAction.java>>
>
>
> -----Original Message-----
> From: Steven Leija [SMTP:[EMAIL PROTECTED]]
> Sent: 20 July 2001 15:50
> To: '[EMAIL PROTECTED]'
> Subject: RE: Tree
>
> Do you have some code to show how you are doing this?
>
> Steven
>
> -----Original Message-----
> From: O'Reilly John [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 20, 2001 6:54 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Tree
>
>
> We are using Cocoon for our presentation (using XML/XSP/XSL). What we
> have
> done is to store menus in static XML files. In response to a request an
> action (making use of a menu manager) can load a specific menu. If the
> action originated from selecting a menu option then that option is modifed
> by setting the "selected" attribute to true. If the option has a sub menu
> then we set "expanded" to true. The XSL can then interpret these
> attributes
> (i.e. not associating a href with an option if selected=true and showing
> the
> sub menu in expanded=true) to display the menu tree.
>
> Has anyone else had experience of using menus with Struts/Cocoon. Is
> there
> a better way of doing the above?
>
>
> -John
>
>
>
>
> > -----Original Message-----
> > From: Matt Raible [SMTP:[EMAIL PROTECTED]]
> > Sent: 19 July 2001 19:56
> > To: [EMAIL PROTECTED]
> > Subject: Re: Tree
> >
> > Have you seen the "struts-menu" application - it uses struts,
> > javascript, and xml to build a DHTML tree.
> >
> > Can be found at:
> >
> > http://husted.com/about/struts/resources.htm#extensions
> >
> > Matt
> >
> >
> > --- Levi Cook <[EMAIL PROTECTED]> wrote:
> > > I agree with Matts points, in addition here are a couple more
> > > thoughts
> > on
> > > the challenge of tree navigation--
> > >
> > > 1) From a mvc design perspective, a tree is just a view; assigning
> > > responsibility of rendering a tree to "a lot of action classes" is
> > probably
> > > not optimal.
> > >
> > > 2) Offhand, a key to building an effective tree view rests with
> > > thinking about recursive associations-- ie. a container class that
> > > may contain
> > itself
> > > (self containment)
> > >
> > > Here's a common example:
> > >
> > > ----------
> > > | Folder |<>-- 1
> > > ---------- |
> > > | * |
> > > | |
> > > ----------
> > >
> > > In this case, a Folder can have zero or more subfolders-- thus
> > > yielding
> > a
> > > hierarchy, or tree :) Each folder can be contained by exactly one
> > folder.
> > >
> > > With this model in mind, I believe you should consider creating a
> > > custom
> > tag
> > > that expects this *type* of structure. Ideally, you're new "tree"
> > > tag
> > would
> > > only need to rely on interfaces from the java collections framework.
> > >
> > >
> > > Regards,
> > > Levi
> > >
> > >
> > > ----- Original Message -----
> > > From: "Gogineni, Pratima" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Thursday, July 19, 2001 10:09 AM
> > > Subject: Tree
> > >
> > >
> > > > Hi
> > > >
> > > > I have been thinking for a while about making a "tree" jsp
> > > > component
> > using
> > > > struts. I like the idea of having a jsp based tree rather than
> > > > using
> > the
> > > > javascript trees that are normally used.
> > > >
> > > > I know I will have to write a lot of action classes to support a
> > *Good*
> > > > generic tree. But does anyone know of any problems with using a
> > > > jsp
> > based
> > > > tree rather than javascript based?
> > > >
> > > > Thanks
> > > > Pratima
> > > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, July 19, 2001 9:05 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: struts-layout
> > > >
> > > >
> > > > Hi there!
> > > >
> > > > I am happy to inform you that the 0.3 version of struts-layout has
> > been
> > > > released on <http://struts.application-servers.com>. struts-layout
> > > > is
> > a
> > > tag
> > > > library for Struts that allows for fast and easy development of
> > > > jsp
> > pages.
> > >
> > > > With
> > > > struts-layout, pages are described with only a small set of
> > > > special
> > tags.
> > > > HTML
> > > > tags are not any more needed (well, nearly), as struts-layout tags
> > > generates
> > > >
> > > > the layout. I kindly invite you to have a look on the site for
> > > > more information.
> > > >
> > > > struts-layout is now used in my company's projects and in
> > > > <http://www.application-servers.com>, a French site dedicated to
> > > information
> > > >
> > > > about application servers. French users can also find an
> > > > introduction
> > to
> > > > Struts
> > > > and struts-layout on this site in the article section.
> > > >
> > > > Please feel free to send me feedbacks and bug reports.
> > > >
> > > > Cheers,
> > > >
> > > > Jean-Noel
> > > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get personalized email addresses from Yahoo! Mail
> > http://personal.mail.yahoo.com/
mainmenu.xml
menu.xsl
PortalAction.java