Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use 'redirect=true' in struts 1.* forward?

Tags:

I've been having some problems with ActionMessages created during execution of an action which didn't display, and I found out that my problems were due to my forwards having redirect=true in struts-config.xml.

Since the default behavior is redirect=false, I've been thinking about which benefits can one have using redirect=true and I couldn't find any answer. Does anyone know when and why redirect=true should be used in action forwards?

like image 219
Raibaz Avatar asked Mar 05 '09 12:03

Raibaz


People also ask

What is redirect true in Struts config XML?

If you specify redirect="true" , Struts uses a client-side redirect [ response. sendRedirect() ]. The JSP will be invoked by a new browser request, and any data stored in the old request will be lost.

How do I redirect from one action to another action in struts2?

The redirect result type calls the standard response. sendRedirect() method, causing the browser to create a new request to the given location.

What is action redirect?

An action issues a redirect to a URL. The actions pipeline is suspended after that Action completes its execution. The user is redirect to the URL along with a state parameter.


1 Answers

it prevents the 'double submit problem'

Never show pages in response to POST

Always load pages using GET

Navigate from POST to GET using REDIRECT

more on this here and here

like image 184
Boris Pavlović Avatar answered Sep 28 '22 07:09

Boris Pavlović