struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Susan Bradeen" <>
Subject Re: request.getContextPath() and Tiles
Date Wed, 18 Dec 2002 14:57:40 GMT
> >
> > using the requestURI='request.getContextPath().concat("/")'
> > 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/")'
> and the links are built properly, but I'd rather not do this. If there 
> a way to dynamically
> retrieve the application module prefix, I could get around hard coding.

I have "resolved" the hard coding of the module path by doing the 
following ...

In the action, set the module-relative path in a request attribute:

public ActionForward execute(...) throws Exception {
        /*Build a module-relative path that Display tags can use for html:link 
"href=" parameter.*/
        ModuleConfig mc = (ModuleConfig) 
        request.setAttribute("linkPath", request.getContextPath().concat(mc.getPrefix()));
        return mapping.findForward("success");


then in the JSP retrieve the path attribute and add on the action ...


There is probably a better way to do this, but this seems to work.

Susan Bradeen

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message