Hi,

  The proposed solution solves the problem when using a struts action, 
but it doesn't work when the targeted URL is a jsp page (as in the 
actual tiles example).
  I agree that my previous solution was too fast, and I haven't tested 
it against older browsers ;-(

Peterkofsky, Don wrote:

>Eddie -
>
>Thanks for the pointer to the request attribute -- that got me what I
>needed.
>
>
>Cedric -
>
>Here is the code snippet below, that will get the action in a robust way,
>and allow us to write out the href in the tabs in a Struts-compatible way;
>you may want to update your tabsLayout JSP example accordingly:
>
><%@ page import="org.apache.struts.config.ActionConfig" %>
><%
>  String key = org.apache.struts.Globals.MAPPING_KEY;
>  ActionConfig actionConfig = (ActionConfig) request.getAttribute(key);
>  String action = actionConfig.getPath();
>  
>  ...
>
><% ///// Struts-tiles tabs rendering logic ///// %>
><logic:iterate id="tab" name="tabList"
>type="org.apache.struts.tiles.beans.MenuItem" >
><% // compute href
>  String href = request.getContextPath() +"/" + action + ".do" +
>"?"+parameterName + "=" + index; // get tab link
>
>
>
>Don P.
>
>
>-----Original Message-----
>From: Eddie Bush [mailto:[EMAIL PROTECTED]]
>Sent: Monday, October 14, 2002 10:50 AM
>To: Struts Users Mailing List
>Subject: Re: Tiles problem with Struts action path - Tiles and tabbed
>disp lay
>
>
>The action mapping is available in the request (!) under the key of 
>o.a.s.Globals.MAPPING_KEY.
>
>
>Peterkofsky, Don wrote:
>
>  
>
>>Cedric -
>>
>>While this solution will work in IE browsers and Netscape 6+ browsers, it
>>isn't a particularly robust solution, as it relies on the URL in the
>>    
>>
>browser
>  
>
>>"location" string, and this varies depending on the particular browser
>>version (try your solution on Netscape 4.7, and see what happens).  
>>
>>A more robust solution requires that we have access to the action path at
>>the JSP level, similar to the way we do in an Action class.  In order to
>>robustly render a URL based on a Tiles list, we need to know the action
>>    
>>
>path
>  
>
>>that initially rendered the Tile.  This suggests to me adding an attribute
>>for this to the Tile object, so that a Tile is "aware" of the action path
>>    
>>
>>from which it was called.  Our other alternative is to have a custom
>request
>  
>
>>processor, which gets the action path and puts it into a request attribute,
>>which will be accessible in the destination JSP -- this is a less robust
>>    
>>
>and
>  
>
>>less desirable solution than having direct access to the action path
>>    
>>
>through
>  
>
>>some Tiles attribute.  For example, I would like to be able to do something
>>like:
>>    action = tile.getActionPath();
>>
>>
>>Don P.
>>
>>    
>>


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

Reply via email to