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]

Reply via email to