You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mo...@dit.unitn.it on 2003/03/07 12:28:30 UTC

Problem mapping/url

Hi, i've a problem with url..how i retrieve the mapping of url in a jsp? for
example i have an jsp as index and an action-mapping as it:
<action type="org.apache.struts.actions.ForwardAction" path="/homeA"
parameter="/index.jsp" />
now in another jsp call homeA.do and i see index.jsp in my browser, the url in
my browser is .../homeA.do but if i try to obtain this url (with
request.getRequestURI() )i obtain /index.jsp and not homeA.do that i would..
It's possible in a jsp retrieve the url that i see in my browser (in this case
homeA.do) instead of the real url???
i'm new to Struts..sorry for my stupid question.
Modena


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


Re: Problem mapping/url

Posted by Nicolas De Loof <ni...@cgey.com>.

> > (with request.getRequestURI() )i obtain /index.jsp and not
homeA.do
>
> getRequestURI() should return the exact address the client
requested,
> minus query string. Perhaps you set redirect to true? But then the
> address displayed in the browser should have been updated to
index.jsp
> as well.
>
>
> --
> Eric Jain
>
>
> --------------------------------------------------------------------
-
> 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: Problem mapping/url

Posted by Eric Jain <Er...@isb-sib.ch>.
> So I don't this it is possible to get the "as in browser" URI.


You're right, just checked SRV.8.4. Strange that this had never bitten
me, of course I always use html:link @page or @action...

Perhaps one workaround would be to store the original request object as
a request attribute in the Action class?


--
Eric Jain


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


Re: Problem mapping/url

Posted by Nicolas De Loof <ni...@cgey.com>.
(Sorry for previous empty message : too quickly clicked !)


On tomcat, websphere and Weblogic I get CURRENT servlet (and JSP) URI
when using
request.getRequestURI(). API Javadoc says :
"Returns the part of this request's URL from the protocol name up to
the query string in the first line of the HTTP request"

I think this appends :

When a forward is used, the RequestDispatcher object updates the
request, to put the "forwarded" URI :
(from javadoc) "For a RequestDispatcher obtained via
getRequestDispatcher(), the ServletRequest object has its path
elements and parameters adjusted to match the path of the target
resource".

So I don't this it is possible to get the "as in browser" URI.

Nico.

> > (with request.getRequestURI() )i obtain /index.jsp and not
homeA.do
>
> getRequestURI() should return the exact address the client
requested,
> minus query string. Perhaps you set redirect to true? But then the
> address displayed in the browser should have been updated to
index.jsp
> as well.
>
>
> --
> Eric Jain
>
>
> --------------------------------------------------------------------
-
> 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: Problem mapping/url

Posted by Eric Jain <Er...@isb-sib.ch>.
> (with request.getRequestURI() )i obtain /index.jsp and not homeA.do

getRequestURI() should return the exact address the client requested,
minus query string. Perhaps you set redirect to true? But then the
address displayed in the browser should have been updated to index.jsp
as well.


--
Eric Jain


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