• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sendRedirect

 
Imran Vohra
Ranch Hand
Posts: 77
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to create a simple servlet with sendRedirect() method as given on PN 136 in HFSJ.

I have put servlet class (Test.class) in {App Directory}/WEB-INF/classes/foo directory
and putting html(Points.html) in {App Directory}/foo/

and code in servlet is like this


DD is like this


As my application name is NewApp
I have written http://localhost:8080/NewApp/Imran.do in browser.
Now question is ...I am expecting that it should redirect it to http://localhost:8080/NewApp/foo/Points.html but instead of that it is redirecting it to http://localhost:8080/foo/Points.html....
I am not getting that why its going outside Application as I have inserted '/' in sendRedirect() method.

Thanks
Imran
 
Mohd Fuzail
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not getting that why its going outside Application as I have inserted '/' in sendRedirect() method.


'/' in sendRedirect means relative to the web app, in this case it's webapps.

If your html file is in your project directory then instead of relative URL, please use foo/Points.html, so now the Web Container will look for http://localhost:8080/NewApp/foo/Points.html
[ August 14, 2006: Message edited by: Fuzail ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic