You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ionel Gardais <io...@geomath.fr> on 2003/05/27 15:16:16 UTC

problems with Tiles regarding the relative links

Hi,

I am facing a problem using tiles.
If I have a link in a page which is supposed to be relative to the 
holding tile, the effective link is relative to the template JSP file 
path provided in the tiles-def.xml

let say I have two files, template.jsp and link.jsp

template.jsp
------------
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>

<html:html locale="true">
 <head>
  <title><bean:message 
key="page.title"/><%=request.getUserPrincipal().getName()%></title>
  <html:base/>
 </head>
 <body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">

 <tiles:get name="link"/>
 </body>
</html:html>

link.jsp
--------
<html:link href="#" 
onclick="window.open('choose_date.jsp?for=Debut','date','width=400,height=200,toolbar=no,location=no,menubar=no');">click 
the link</html:link>

tile-def.xml
------------
<tiles-definitions>
  <definition name=".main" path="/template.jsp">
    <put name="link" value="/link.jsp"/>
  </definition>
</tiles-definitions>

When I try to click the link declared in link.jsp, it is relative to 
template.jsp instead of link.jsp which is very problematic to me.

Is there a solution to this ?

thanks,
ionel



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


Re: problems with Tiles regarding the relative links

Posted by Tin Pham <tt...@learn.senecac.on.ca>.
Well one solution is indeed as Mark mentions, to use exclusively struts tags
for linking.

I solved it by placing the template file at the root of my web folder. I
notice you're using the html base tag so that would make all your links then
relative to the root.

Then you require the forward slash then, so to reference an image in
/images/a.gif  you would use src="images/a.gif"




"Ionel Gardais" <io...@geomath.fr> wrote in message
news:3ED36520.7010500@geomath.fr...
> Hi,
>
> I am facing a problem using tiles.
> If I have a link in a page which is supposed to be relative to the
> holding tile, the effective link is relative to the template JSP file
> path provided in the tiles-def.xml
>
> let say I have two files, template.jsp and link.jsp
>
> template.jsp
> ------------
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
>
> <html:html locale="true">
>  <head>
>   <title><bean:message
> key="page.title"/><%=request.getUserPrincipal().getName()%></title>
>   <html:base/>
>  </head>
>  <body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">
>
>  <tiles:get name="link"/>
>  </body>
> </html:html>
>
> link.jsp
> --------
> <html:link href="#"
>
onclick="window.open('choose_date.jsp?for=Debut','date','width=400,height=20
0,toolbar=no,location=no,menubar=no');">click
> the link</html:link>
>
> tile-def.xml
> ------------
> <tiles-definitions>
>   <definition name=".main" path="/template.jsp">
>     <put name="link" value="/link.jsp"/>
>   </definition>
> </tiles-definitions>
>
> When I try to click the link declared in link.jsp, it is relative to
> template.jsp instead of link.jsp which is very problematic to me.
>
> Is there a solution to this ?
>
> thanks,
> ionel




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


Re: problems with Tiles regarding the relative links

Posted by Mark Lowe <ma...@talk21.com>.
now i've read you problem better..

If the template is the page that does the inserts that the page  
relative to which requests will be made.


On Tuesday, May 27, 2003, at 15:16 Europe/Rome, Ionel Gardais wrote:

> Hi,
>
> I am facing a problem using tiles.
> If I have a link in a page which is supposed to be relative to the  
> holding tile, the effective link is relative to the template JSP file  
> path provided in the tiles-def.xml
>
> let say I have two files, template.jsp and link.jsp
>
> template.jsp
> ------------
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
>
> <html:html locale="true">
> <head>
>  <title><bean:message  
> key="page.title"/><%=request.getUserPrincipal().getName()%></title>
>  <html:base/>
> </head>
> <body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">
>
> <tiles:get name="link"/>
> </body>
> </html:html>
>
> link.jsp
> --------
> <html:link href="#"  
> onclick="window.open('choose_date.jsp?for=Debut','date','width=400,heig 
> ht=200,toolbar=no,location=no,menubar=no');">click the > link</html:link>
>
> tile-def.xml
> ------------
> <tiles-definitions>
>  <definition name=".main" path="/template.jsp">
>    <put name="link" value="/link.jsp"/>
>  </definition>
> </tiles-definitions>
>
> When I try to click the link declared in link.jsp, it is relative to  
> template.jsp instead of link.jsp which is very problematic to me.
>
> Is there a solution to this ?
>
> thanks,
> ionel
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: problems with Tiles regarding the relative links

Posted by Mark Lowe <ma...@talk21.com>.
so in template jsp you've an insert that writes this page with the js  
popup?

generally to avoid issues with relative path etc i use the page  
attribute.

<html:link page="/mypage.jsp">





On Tuesday, May 27, 2003, at 15:16 Europe/Rome, Ionel Gardais wrote:

> Hi,
>
> I am facing a problem using tiles.
> If I have a link in a page which is supposed to be relative to the  
> holding tile, the effective link is relative to the template JSP file  
> path provided in the tiles-def.xml
>
> let say I have two files, template.jsp and link.jsp
>
> template.jsp
> ------------
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
>
> <html:html locale="true">
> <head>
>  <title><bean:message  
> key="page.title"/><%=request.getUserPrincipal().getName()%></title>
>  <html:base/>
> </head>
> <body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">
>
> <tiles:get name="link"/>
> </body>
> </html:html>
>
> link.jsp
> --------
> <html:link href="#"  
> onclick="window.open('choose_date.jsp?for=Debut','date','width=400,heig 
> ht=200,toolbar=no,location=no,menubar=no');">click the > link</html:link>
>
> tile-def.xml
> ------------
> <tiles-definitions>
>  <definition name=".main" path="/template.jsp">
>    <put name="link" value="/link.jsp"/>
>  </definition>
> </tiles-definitions>
>
> When I try to click the link declared in link.jsp, it is relative to  
> template.jsp instead of link.jsp which is very problematic to me.
>
> Is there a solution to this ?
>
> thanks,
> ionel
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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