You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wbyeats <ma...@emmedici.com> on 2006/08/02 22:09:25 UTC

Find out the old url after struts forwarding

Hi guys,

I have this problem: I'm using websphere 4, wth JDK 1.3 and J2EE 1.2, and
struts.
I have set an action that after doing some coding would forward
(redirect=false) to a jsp. In the browser url I correctly see the .do url.

If in that page I ask for a request.getRequestURI() I get the url of the new
jsp. How should I find out the old .do url as the request is still the same?
Is there any way?

Thanks a lot in advance!!

mario

-- 
View this message in context: http://www.nabble.com/Find-out-the-old-url-after-struts-forwarding-tf2042007.html#a5621340
Sent from the Struts - User forum at Nabble.com.


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


Re: Find out the old url after struts forwarding

Posted by Michael Jouravlev <jm...@gmail.com>.
On 8/2/06, Wbyeats <ma...@emmedici.com> wrote:
>
> Hi guys,
>
> I have this problem: I'm using websphere 4, wth JDK 1.3 and J2EE 1.2, and
> struts.
> I have set an action that after doing some coding would forward
> (redirect=false) to a jsp. In the browser url I correctly see the .do url.
>
> If in that page I ask for a request.getRequestURI() I get the url of the new
> jsp. How should I find out the old .do url as the request is still the same?

request.getRequestURL() work for me, returning full URL including
"http" and port number. If you need URI only, use
request.getAttribute("javax.servlet.forward.request_uri")

http://www.javaworld.com/javaworld/jw-03-2003/jw-0328-servlet_p.html

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


Re: Find out the old url after struts forwarding

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
It's already there, as a request attribute, under the key 
"org.apache.struts.action.mapping.instance", or more precisely, under 
the key named by the value of Globals.MAPPING_KEY.

Frank

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
  (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
  Supplying the wheel, so you don't have to reinvent it!

Monkeyden wrote:
> Pass it to the JSP from the action in the request object?  action form?
> session?  Pick your poison.
> 
> request.setAttribute("URL", mapping.getPath() + "?language=swahili");
> 
> 
> 
> 
> On 8/2/06, Wbyeats <ma...@emmedici.com> wrote:
>>
>>
>> But how would I use a mapping.getPath() inside a jsp?
>>
>> mario
>> -- 
>> View this message in context:
>> http://www.nabble.com/Find-out-the-old-url-after-struts-forwarding-tf2042007.html#a5623015 
>>
>> Sent from the Struts - User forum at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 


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


Re: Find out the old url after struts forwarding

Posted by Monkeyden <mo...@gmail.com>.
Pass it to the JSP from the action in the request object?  action form?
 session?  Pick your poison.

request.setAttribute("URL", mapping.getPath() + "?language=swahili");




On 8/2/06, Wbyeats <ma...@emmedici.com> wrote:
>
>
> But how would I use a mapping.getPath() inside a jsp?
>
> mario
> --
> View this message in context:
> http://www.nabble.com/Find-out-the-old-url-after-struts-forwarding-tf2042007.html#a5623015
> Sent from the Struts - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Find out the old url after struts forwarding

Posted by Wbyeats <ma...@emmedici.com>.
But how would I use a mapping.getPath() inside a jsp?

mario
-- 
View this message in context: http://www.nabble.com/Find-out-the-old-url-after-struts-forwarding-tf2042007.html#a5623015
Sent from the Struts - User forum at Nabble.com.


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


Re: Find out the old url after struts forwarding

Posted by Monkeyden <mo...@gmail.com>.
mapping.getPath()

On 8/2/06, Wbyeats <ma...@emmedici.com> wrote:
>
>
> > I suppose you could get the http referer but it would have nothing to do
> > with what you see in the browser address bar.
> > req.getHeader("Referer");
>
> Nope, that's not what I want. I need this as I want to make a link to
> reload
> page changing the language. So I want the url of the page I'm seeing. This
> could be a .jsp and that is not a problem, but in case of a .do I would
> like
> to have the .do url not the resultant .jsp url.
> As I'm keeping the request I don't see why I can't have the original
> url...
>
> mario
> --
> View this message in context:
> http://www.nabble.com/Find-out-the-old-url-after-struts-forwarding-tf2042007.html#a5622597
> Sent from the Struts - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Find out the old url after struts forwarding

Posted by Wbyeats <ma...@emmedici.com>.
> I suppose you could get the http referer but it would have nothing to do 
> with what you see in the browser address bar. 
> req.getHeader("Referer");

Nope, that's not what I want. I need this as I want to make a link to reload
page changing the language. So I want the url of the page I'm seeing. This
could be a .jsp and that is not a problem, but in case of a .do I would like
to have the .do url not the resultant .jsp url.
As I'm keeping the request I don't see why I can't have the original url...

mario
-- 
View this message in context: http://www.nabble.com/Find-out-the-old-url-after-struts-forwarding-tf2042007.html#a5622597
Sent from the Struts - User forum at Nabble.com.


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


Re: Find out the old url after struts forwarding

Posted by Monkeyden <mo...@gmail.com>.
I suppose you could get the http referer but it would have nothing to do
with what you see in the browser address bar.

req.getHeader("Referer");



On 8/2/06, Wbyeats <ma...@emmedici.com> wrote:
>
>
> Hi guys,
>
> I have this problem: I'm using websphere 4, wth JDK 1.3 and J2EE 1.2, and
> struts.
> I have set an action that after doing some coding would forward
> (redirect=false) to a jsp. In the browser url I correctly see the .do url.
>
> If in that page I ask for a request.getRequestURI() I get the url of the
> new
> jsp. How should I find out the old .do url as the request is still the
> same?
> Is there any way?
>
> Thanks a lot in advance!!
>
> mario
>
> --
> View this message in context:
> http://www.nabble.com/Find-out-the-old-url-after-struts-forwarding-tf2042007.html#a5621340
> Sent from the Struts - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>