File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

response.sendRedirect issue

 
Adi Kulkarni
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a servlet which has a some logic after which it does a send redirect.

response.sendRedirect("url") ;
Now this works fine on my local setup and the url page is displayed properly. However, when I try it on a different setup, the url shows a servlet name and the page is blank.

What might be the reason for this ? . There is a return statement after the redirect.

Is it some problem with the redirect ?

thanks,
Aditya
 
Pravin Shirke
Ranch Hand
Posts: 150
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Adi,
Can you post the url please. whether it is relative url or absolute url? which you have used?
 
Amit Ghorpade
Bartender
Posts: 2851
10
Fedora Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to check the url and a return statement after a redirect is not really helpful.
Are you sure there is no exception?
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The URL is relative. Its something like . response.sendRedirect("confirmation.jsp")

I can't see the logs for exception because its on some other machine. But I'm puzzled because its working properly on my local setup.

Also, just the redirect is not happening and all the backend updations are happening.

thanks,
Aditya
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adi Kulkarni wrote:The URL is relative. Its something like . response.sendRedirect("confirmation.jsp")

Page-relative URLs are very fragile. The first thing I'd do is to change this to a server-relative URL that begins with the context path.
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Bear,

I noticed that our url has some blank spaces.

Example


response.sendRedirect("confirmation.jsp?a=<variable1>&b=<variable2> &c=<variable3>")


Will this blank page cause issues. Also from the log trace that we have got, the sendRedirect is getting called and after that there is some user defined exception.

Thanks,
Aditya
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic