• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

return statement after response.sendRedirect() method?

 
Prakash Mani - Attur
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
will the return statement return anything if redirected the page before we return something?
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Prakash Mani - Attur
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic