Yeps, nice to hear that someone understood my point ;)

Okey, does anyone have any sample code how to implement this kind
of controller? In my case I have to keep track of two menuitem selections (banner and left menu) so, it's getting a little bit more complicated.
Also selection from body area (Action based userinterface class) might
activate menuitems and highlight them in banner and left menu.
So, quite complicated ...


I would be happy to get any help considering this menu problem.
Both my approach and Gregs's one are appreciated.

Thanks,

rick


From: <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: RE: Can this kind of code work?
Date: Thu, 27 Feb 2003 10:02:28 -0600

I think I see what you're trying to do: It looks like you want to keep track of what menu item is highlighted. I don't think this information should be pushed down to the action layer. I would use a Tile to render the menu, and perhaps a Tiles controller to determine which item is highlighted. One way to do it would be to pass a request parameter noting an index of the menu item that was clicked. Then the Tiles controller could look at that parameter to highlight the correct one.

Greg


> -----Original Message----- > From: Rick Ashley [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 27, 2003 7:46 AM > To: [EMAIL PROTECTED] > Subject: Can this kind of code work? > > > I like to add dynamically key-value pair properties in my Struts > application. I have tried code below, but with no success... > Are there any (or other way) to make this kind of code to work. > > Br > > .............. > > public ActionForward execute(ActionMapping mapping, ActionForm form, > javax.servlet.http.HttpServletRequest request, > javax.servlet.http.HttpServletResponse response) > { > ActionForward af; > // Fetching parameters with key from collection. > // Key to item is what mapping.getPath returns. > MenuHighlightItem menuItem = MenuParameters.getItemInfo > (mapping.getPath()); > // Parameters found, let's add them to request. > if(menuItem != null) > { > if(menuItem.getData().length() != 0) > { > path += "&"; > path += URLEncoder.encode("selected_leftbanner"); > path += "="; > path += URLEncoder.encode(menuItem.getData()); > } > } > > try > { > if(menuItem != null) > { > af = super.execute(mapping, form, request, response); > af.setPath(path); > } > else > { > return super.execute(mapping, form, request, response); > } > } > catch(Exception ex) > { > af = null; > } > return af; > } >

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Stay in touch with MSN Messenger http://messenger.msn.co.uk


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to