You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by lei jiang <ji...@gmail.com> on 2010/07/07 12:12:02 UTC

the welcome file "index.jsp" returns an 302 redirection

Hi, guys:

I am using the Tomcat 5.0.28.0, and I put the my website into webapps directory.

The welcome-file-list section likes this:

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

In the index.jsp, I use the jsp:forward tag to forward the request to
a struts action:
<jsp:forward page="welcome.do"/>

When I input "http://localhost:8080/mysite" into the address bar of
firefox and hit go button, the browser shows the correct page but the
url in address bar changed to
"http://localhost:8080/mysite/welcome.do"

I find that the tomcat returns a 302 redirection and then the tomcat
returns the page generated by "welcome.do" action

So what can we do to aviod the 302 redirection and let the address bar
just show "http://localhost:8080/mysite".

Thanks
Regards
-- 
Lei Jiang
Member of SeedClass in the Department of Electronics and Information Engineering
Member of Overseas group in Dian team
Room 507, Building D7,1037 Luoyu Road, Wuhan 430074,P.R.China
Mobile:+86-15926351274
Email: <ji...@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: the welcome file "index.jsp" returns an 302 redirection

Posted by Bill Barker <bi...@verizon.net>.

"lei jiang" <ji...@gmail.com> wrote in message 
news:AANLkTin0dhodp9BrzlX589xKVUZ4DAR0DNKLrY637arZ@mail.gmail.com...
> Hi, guys:
>
> I am using the Tomcat 5.0.28.0, and I put the my website into webapps 
> directory.
>
> The welcome-file-list section likes this:
>
> <welcome-file-list>
>    <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> In the index.jsp, I use the jsp:forward tag to forward the request to
> a struts action:
> <jsp:forward page="welcome.do"/>
>
> When I input "http://localhost:8080/mysite" into the address bar of
> firefox and hit go button, the browser shows the correct page but the
> url in address bar changed to
> "http://localhost:8080/mysite/welcome.do"
>
> I find that the tomcat returns a 302 redirection and then the tomcat
> returns the page generated by "welcome.do" action
>
> So what can we do to aviod the 302 redirection and let the address bar
> just show "http://localhost:8080/mysite".
>

What Pid said:  Later versions than 5.0.x do an internal forward to the 
welcome-file, so the browser doesn't get to see the actual path to the 
welcome-file.  There are a couple of other sordid hacks using 
servlet-mapping that I'll admit to using on currently unsupported versions 
of Tomcat.

> Thanks
> Regards
> -- 
> Lei Jiang
> Member of SeedClass in the Department of Electronics and Information 
> Engineering
> Member of Overseas group in Dian team
> Room 507, Building D7,1037 Luoyu Road, Wuhan 430074,P.R.China
> Mobile:+86-15926351274
> Email: <ji...@gmail.com> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: the welcome file "index.jsp" returns an 302 redirection

Posted by Pid <pi...@pidster.com>.
On 07/07/2010 11:25, André Warnier wrote:
> lei jiang wrote:
>> Hi, guys:
>>
>> I am using the Tomcat 5.0.28.0, and I put the my website into webapps
>> directory.
>>
>> The welcome-file-list section likes this:
>>
>> <welcome-file-list>
>>     <welcome-file>index.jsp</welcome-file>
>> </welcome-file-list>
>>
>> In the index.jsp, I use the jsp:forward tag to forward the request to
>> a struts action:
>> <jsp:forward page="welcome.do"/>
>>
>> When I input "http://localhost:8080/mysite" into the address bar of
>> firefox and hit go button, the browser shows the correct page but the
>> url in address bar changed to
>> "http://localhost:8080/mysite/welcome.do"
>>
>> I find that the tomcat returns a 302 redirection and then the tomcat
>> returns the page generated by "welcome.do" action
>>
>> So what can we do to aviod the 302 redirection and let the address bar
>> just show "http://localhost:8080/mysite".
>>
> Naive suggestions :
> 
> 1)
>  <welcome-file-list>
>      <welcome-file>welcome.do</welcome-file>
>  </welcome-file-list>
> 
> 2) delete index.jsp and rename welcome.do to index.jsp

3) Upgrade your Tomcat, 5.0.x isn't supported anymore and it's REALLY OLD.


p


> ?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



Re: the welcome file "index.jsp" returns an 302 redirection

Posted by André Warnier <aw...@ice-sa.com>.
lei jiang wrote:
> Hi, guys:
> 
> I am using the Tomcat 5.0.28.0, and I put the my website into webapps directory.
> 
> The welcome-file-list section likes this:
> 
> <welcome-file-list>
>     <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
> 
> In the index.jsp, I use the jsp:forward tag to forward the request to
> a struts action:
> <jsp:forward page="welcome.do"/>
> 
> When I input "http://localhost:8080/mysite" into the address bar of
> firefox and hit go button, the browser shows the correct page but the
> url in address bar changed to
> "http://localhost:8080/mysite/welcome.do"
> 
> I find that the tomcat returns a 302 redirection and then the tomcat
> returns the page generated by "welcome.do" action
> 
> So what can we do to aviod the 302 redirection and let the address bar
> just show "http://localhost:8080/mysite".
> 
Naive suggestions :

1)
  <welcome-file-list>
      <welcome-file>welcome.do</welcome-file>
  </welcome-file-list>

2) delete index.jsp and rename welcome.do to index.jsp

?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org