You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Peterkofsky, Don" <Do...@nike.com> on 2002/10/14 19:41:30 UTC

RE: Tiles problem with Struts action path - Tiles and tabbed disp lay

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.

-----Original Message-----
From: Cedric Dumoulin [mailto:cedric@apache.org]
Sent: Monday, October 14, 2002 2:47 AM
To: Struts Users Mailing List
Subject: Re: Tiles and tabbed display



  Hi,

  You are right that the actual code doesn't works well if you use an 
action URL instead of a jsp URL.
  The solution is to not set the page URI at all when computing the tabs 
href. Like this, the browser use the original URL. To do this, simply 
replace the offending line by:

 // compute href
  String href = "?"+parameterName + "=" + index;

         Cedric

Peterkofsky, Don wrote:

>Cedric -
>
>I've been using Struts/Tiles to implement a tabbed display page, and in
>general it works very nicely.
>
>However, I think there is an oversight in the tabsLayout example, which
will
>cause a problem in use.  This has to do with how the href is calculated for
>the links in the tabs.  In the iteration through the tabsList, this code is
>setting the href for each tab:
>
> // compute href
>  String href = request.getRequestURI() + "?"+parameterName + "=" + index;
>
>By doing this, we will end up with a link to the jsp file of the tabbed
>display page, which we don't want, rather than a link to the action that
>calls the jsp, which is what we do want.  By doing it the way it is done in
>the tabsLayout.jsp, the links from the tabs will not go through an action
>and will not go through the Struts controller, and therefore won't be able
>to process the Tiles.
>
>For example, what we want to see in a tab href is:
>
>http://localhost:8080/wctemplates/tabstemplate.do?tab=1
>
>However, what we do see is:
>
>http://localhost:8080/wctemplates/tabsLayout.jsp?tab=1
>
>
>What needs to happen, is for each tab href to be a link that is made up of
>the action name, i.e."/servlet/tabAction.do?selected=1".
>
>Have you experienced this issue, or had any previous inquiries about this?
>What are your thoughts?
>
>Thanks,
>Don Peterkofsky
>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>  
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tiles problem with Struts action path - Tiles and tabbed disp lay

Posted by Eddie Bush <ek...@swbell.net>.
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.
>
-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>