struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Susan Bradeen" <Sus...@softlanding.com>
Subject Re: request.getContextPath() and Tiles
Date Tue, 17 Dec 2002 20:36:43 GMT
Please see below ...

On 12/17/2002 02:12:23 PM "Susan Bradeen" wrote:

> Hi Cedric,
> 
> Currently, I am using an html:link from a simple "navigation bar" JSP 
tile
> to get to this page.
> 
> <snip from navbar.jsp>
> <td><html:link page="/showlist.do"><bean:message 
> key="main.list"/></html:link></td>
> </snip>
> 
> which correctly becomes:
> <snip>
> <td><a href="/myWebApp/myModule/showlist.do">View List</a></td>
> </snip>
> 
> Without Tiles my display tag was:
> <snip from showList.jsp>
> <display:table name="myform" property="myList" pagesize="15" 
> requestURI="showlist.do">
> </snip>
> 
> which creates a link of:
> <snip>
> <a href="showrequests.do?page=2">2</a>
> </snip>
> 
> and with Tiles, this gives me the URL of:
> "http://localhost/myWebApp/myModule/tiles/layout/showlist.do?page=2"

which needs to be "http://localhost/myWebApp/myModule/showlist.do?page=2"
in order to work.

> 
> using the requestURI='request.getContextPath().concat("/showlist.do")'
> gets me closer, but still not quite there.


I can get around this by hard coding "myModule" into the path, such as ...

requestURI='request.getContextPath().concat("/myModule/showlist.do")'

and the links are built properly, but I'd rather not do this. If there was 
a way to dynamically
retrieve the application module prefix, I could get around hard coding.

 Any html:link using a "page=" attribute creates a Tiles link/Action path 
correctly 
and works great. Unfortunately, the Display tag library makes use of 
"href=" attribute.

Thanks again for your help.
Susan Bradeen

> 
> Tiles definitions ----
> 
> <definition name=".showList"  extends=".navbarBase">
> <put name="title" value="View List"/>
> <put name="content" value="/myModule/showList.jsp"/>
> </definition>
> 
> <definition name=".navbarBase" 
path="/myModule/tiles/layouts/navbarBase.jsp">
> <put name="title" value="${title}"/>
> <put name="header" value="/myModule/tiles/header.jsp"/>
> <put name="navbar" value="/myModule/tiles/navbar.jsp"/>
> <put name="content" value="${content}"/>
> <put name="footer" value="/myModule/tiles/footer.jsp"/>
> </definition>
> 
> Action definition -----
> 
> <action
> path="/showlist"
> type="com.my.company.actions.ShowListAction"
> name="myform"
> scope="request"
> validate="false">
> <forward name="success" path=".showList"/>
> </action>
> 
> This is more information than you asked for, but hope it helps. Thanks 
for
> your response.
> 
> Susan Bradeen
> 
> On 12/17/2002 12:30:51 PM Cedric Dumoulin wrote:
> 
> > What URL do you use to call the page or action in which you do the
> > request.getContextPage() ?
> >
> > Cedric
> >
> > Susan Bradeen wrote:
> >
> > >This is exactly what I am trying to do ...
> > >
> >
> 
>http://www.mail-archive.com/struts-user@jakarta.apache.org/msg37691.html
> > >
> > >I would like to set
> > >requestURI='request.getContextPath().concat("/something.do")'
> > >however, my "request.getContextPath()" is not including my module in
> that
> > >path.
> > >
> > >For example, I am getting ...
> > >        http://localhost/myWebApp/myAction.do
> > > instead of ...
> > >        http://localhost/myWebApp/myModule/myAction.do
> > >
> > >Tiles is working perfectly for all Action links (<html:link
> > >page="/myAction.do">),
> > >but for two <html:link href="..."> links I am trying to set up, I 
can't
> > >get the correct path.
> > >
> > >All suggestions are greatly appreciated.
> > >
> > >Thanks,
> > >Susan Bradeen
> > >
> > >--
> > >To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > >For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> > >
> > >
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> >
> 
> --
> To unsubscribe, e-mail: 
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
<mailto:struts-user-help@jakarta.apache.org>
> 

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


Mime
View raw message