You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Damian Wildie <wi...@insysco.com.au> on 2003/04/10 17:19:40 UTC

Struts, Tiles and relative paths

I have just updated to Struts 1.1 RC1 from 1.1 B2 and have encountered a
problem with relative paths. 
I am using Tomcat 4.1.10, and have also achieved the same results using
Tomcat 4.1.24.
 
The browser request is processed as follows:
Browser requests /app1/mod1/applicationList/display.do which
subsequently forwards (via an action forward) to
/jsp/pages/applicationList.jsp - whose absolute path is
/app1/mod1/jsp/pages/applicationList.jsp
applicationList.jsp contains a <tiles:insert> tag to a definition
../layout/myLayout.jsp - whose absolute path is
/app1/mod1/jsp/layout/myLayout.jsp.
 
This works with 1.1 B2, however, 1.1 RC1 (and 1.1 B3) fails to include
myLayout.jsp.  I have traced through the 1.1 RC1 source to the
doInclude() method in TilesUtilImpl.java.
The request.getRequestDispatcher("../layout/myLayout.jsp") method is
resolving the relative path to /app1/mod1/layout/myLayout.jsp and not
/app1/mod1/jsp/layout/myLayout.jsp as I expected.
This appears to be due to the request.getRequestDispatcher() method is
being implemented by the request's ancestor class CoyoteRequest.java
(Tomcat Connectors)
which uses the initial request path,
app1/mod1/applicationList/display.do,  as the base for resolving
relative paths.
 
The implementation of tiles:insert seems to have changed significantly
between 1.1 B2 and B3. Is using the tiles:insert tag in this way
recommended ?
I want to use relative paths as I will have a reasonable number of
reconfigurable modules and want to be able to easily move layouts
between the modules.
 
Any advice would be appreciated. 
 
regards Damian Wildie
 
-- Information Systems Consultants Pty Ltd --
 
 

Re: Struts, Tiles and relative paths

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  Hi,

Damian Wildie wrote:

>I have just updated to Struts 1.1 RC1 from 1.1 B2 and have encountered a
>problem with relative paths. 
>I am using Tomcat 4.1.10, and have also achieved the same results using
>Tomcat 4.1.24.
> 
>The browser request is processed as follows:
>Browser requests /app1/mod1/applicationList/display.do which
>subsequently forwards (via an action forward) to
>/jsp/pages/applicationList.jsp - whose absolute path is
>/app1/mod1/jsp/pages/applicationList.jsp
>applicationList.jsp contains a <tiles:insert> tag to a definition
>../layout/myLayout.jsp - whose absolute path is
>/app1/mod1/jsp/layout/myLayout.jsp.
> 
>This works with 1.1 B2, however, 1.1 RC1 (and 1.1 B3) fails to include
>myLayout.jsp.  I have traced through the 1.1 RC1 source to the
>doInclude() method in TilesUtilImpl.java.
>The request.getRequestDispatcher("../layout/myLayout.jsp") method is
>resolving the relative path to /app1/mod1/layout/myLayout.jsp and not
>/app1/mod1/jsp/layout/myLayout.jsp as I expected.
>This appears to be due to the request.getRequestDispatcher() method is
>being implemented by the request's ancestor class CoyoteRequest.java
>(Tomcat Connectors)
>which uses the initial request path,
>app1/mod1/applicationList/display.do,  as the base for resolving
>relative paths.
> 
>The implementation of tiles:insert seems to have changed significantly
>between 1.1 B2 and B3. 
>
  Yes, but the latest nightly build has go back to the initial 
implemantation. So, your application should work again as before.

>Is using the tiles:insert tag in this way
>recommended ?
>
  No, you should avoid using relative paths (../xxx) with Tiles. This is 
because you can't really says from where a tile will be inserted.

  Cedric

>I want to use relative paths as I will have a reasonable number of
>reconfigurable modules and want to be able to easily move layouts
>between the modules.
> 
>Any advice would be appreciated. 
> 
>regards Damian Wildie
> 
>-- Information Systems Consultants Pty Ltd --
> 
> 
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org