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

Redirect url in struts

 
Sree Vidhya Ram
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers
Hi!

Can any one clarify me the best way to redirect url in struts framework?

In the action bean we can use response.sendRedirect method to redirect to entirely different url.

This does violate to struts framework since we dont pass the control back to controller.

Instead if we do pass to controller and in the view layer say we use logic:redirect it does redirect to the required page.

Which is the best way or best practice to do?
What is the downside in each of the above ways?

Thanks!
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Controller gets no less control with a redirect than without one.

You can specify that a forward is a redirect in your struts-config.
 
Sree Vidhya Ram
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnks for your reply.
Yep I agree that the forward is a redirect in struts-config. That is how the struts framework speaks in the spec.

So can i presume that using sendRedirect in action bean does not violate the struts framework as the controller does not handle the task?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic