File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes return statement after response.sendRedirect() method? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "return statement after response.sendRedirect() method?" Watch "return statement after response.sendRedirect() method?" New topic
Author

return statement after response.sendRedirect() method?

Prakash Mani - Attur
Ranch Hand

Joined: Oct 08, 2009
Posts: 100
will the return statement return anything if redirected the page before we return something?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

If you are asking about Struts 2.x, you return null from your action method. For Struts 1.x too I think you need to return null but I'm not sure...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Prakash Mani - Attur
Ranch Hand

Joined: Oct 08, 2009
Posts: 100
hey i have tried it on myself by creating a method which returns a String, has response.senRedirect("google.com") before return... then i called this method from execute method... it gives no respect to my call.. also i have put redirect method in many places of execute method, its not at all redirecting......simply skipping that line?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

So you returned a String from a method separate from the execute method called by Struts?? The method called by struts should return null. It would be better if you show us some code to make it easier to understand your problem...
Prakash Mani - Attur
Ranch Hand

Joined: Oct 08, 2009
Posts: 100
Ankit, see my code below...

the test method is given below..


its not at all executing the 4th and 5th line of the submit method...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: return statement after response.sendRedirect() method?
 
Similar Threads
History.back()
How To Stop the execution of the Action Class
response.sendRedirect Immediately In Struts
initialising db connection
Window Closing...