• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Redirect url in struts

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic