You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joachim Gjesdal <jo...@ecomda.de> on 2001/07/16 11:26:16 UTC

action mapping url and root context

Some more on root context... 

Running struts 1.0 on Atg Dynamo 5.1 w/patch 1.1.p2 
The context root (myroot) is added twice when the html is written: 


I.e. 
<html:form action="myaction.do"> is written as : <form name="myForm" 
method="POST" action="/myroot/myroot/myaction.do"> 


Any variations on "/myaction" or ''/myacion.do" that someone suggested
has no effect. 


I looked in the source code for the <html:form> tag  and this is
performed: 


protected String getActionMappingURL() { 


        HttpServletRequest request = 
            (HttpServletRequest) pageContext.getRequest(); 
        StringBuffer value = new StringBuffer(request.getContextPath());



    (....) 


} 
  
Apparently ATG also does this somehow (Tomcat does not). I'm not sure if
the taglib should do this or  the jsp engine? 
Its tedious to customize STRUTS taglibs since this is done throughout
the taglibs (i.e also in the  <html:img> tag). 
I've seen references to this problem on this list before, but no
solutions. 


Any ideas would be greatly appreciated. 


thanks, 


joachim


Re: action mapping url and root context

Posted by Joachim Gjesdal <jo...@ecomda.de>.
Just found out. The problem is in ATG implementation of
"response.encodeURL(...)".
When request.getContextPath() returns "/myroot" (beginning with a slash), ATG's
version of encodeURL() automatically adds the root....
I guess this is not J2EE behavior??

joachim

Joachim Gjesdal wrote:

> Not exactly,  "request.getContextPath()"  returns "/myroot",  but somewhere
> along the way ATG is adding the root one more time...
> Although I could do a workaround with action mappings, this would not work
> since the problem also applies to other tags
> like <html:img>.
>
> joachim
>
> Ted Husted wrote:
>
> > So are you saying that in response to "request.getContextPath()" ATG
> > returns
> >
> > "/myroot/myroot"
> >
> > If the container is broken, a workaround until it is fixed would be to
> > add the root context to your ActionMappings (and then just take them out
> > again when the issue is resolved).
> >
> > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > -- Custom Software ~ Technical Services.
> > -- Tel 716 737-3463.
> > -- http://www.husted.com/about/struts/
> >
> > Joachim Gjesdal wrote:
> > > protected String getActionMappingURL() {
> > >
> > >         HttpServletRequest request =
> > >             (HttpServletRequest) pageContext.getRequest();
> > >         StringBuffer value = new
> > > StringBuffer(request.getContextPath());
> > >
> > >     (....)
> > >
> > > }
> > >
> > > Apparently ATG also does this somehow (Tomcat does not). I'm not sure
> > > if the taglib should do this or  the jsp engine?
> > > Its tedious to customize STRUTS taglibs since this is done throughout
> > > the taglibs (i.e also in the  <html:img> tag).
> > > I've seen references to this problem on this list before, but no
> > > solutions.
> > >
> > > Any ideas would be greatly appreciated.
> > >
> > > thanks,
> > >
> > > joachim

Re: action mapping url and root context

Posted by Joachim Gjesdal <jo...@ecomda.de>.
Not exactly,  "request.getContextPath()"  returns "/myroot",  but somewhere
along the way ATG is adding the root one more time...
Although I could do a workaround with action mappings, this would not work
since the problem also applies to other tags
like <html:img>.

joachim


Ted Husted wrote:

> So are you saying that in response to "request.getContextPath()" ATG
> returns
>
> "/myroot/myroot"
>
> If the container is broken, a workaround until it is fixed would be to
> add the root context to your ActionMappings (and then just take them out
> again when the issue is resolved).
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel 716 737-3463.
> -- http://www.husted.com/about/struts/
>
> Joachim Gjesdal wrote:
> > protected String getActionMappingURL() {
> >
> >         HttpServletRequest request =
> >             (HttpServletRequest) pageContext.getRequest();
> >         StringBuffer value = new
> > StringBuffer(request.getContextPath());
> >
> >     (....)
> >
> > }
> >
> > Apparently ATG also does this somehow (Tomcat does not). I'm not sure
> > if the taglib should do this or  the jsp engine?
> > Its tedious to customize STRUTS taglibs since this is done throughout
> > the taglibs (i.e also in the  <html:img> tag).
> > I've seen references to this problem on this list before, but no
> > solutions.
> >
> > Any ideas would be greatly appreciated.
> >
> > thanks,
> >
> > joachim

Re: action mapping url and root context

Posted by Ted Husted <hu...@apache.org>.
So are you saying that in response to "request.getContextPath()" ATG
returns 

"/myroot/myroot"

If the container is broken, a workaround until it is fixed would be to
add the root context to your ActionMappings (and then just take them out
again when the issue is resolved).

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


Joachim Gjesdal wrote:
> protected String getActionMappingURL() {
> 
>         HttpServletRequest request =
>             (HttpServletRequest) pageContext.getRequest();
>         StringBuffer value = new
> StringBuffer(request.getContextPath());
> 
>     (....)
> 
> }
> 
> Apparently ATG also does this somehow (Tomcat does not). I'm not sure
> if the taglib should do this or  the jsp engine?
> Its tedious to customize STRUTS taglibs since this is done throughout
> the taglibs (i.e also in the  <html:img> tag).
> I've seen references to this problem on this list before, but no
> solutions.
> 
> Any ideas would be greatly appreciated.
> 
> thanks,
> 
> joachim