- Action Chains: This feature works by applying a test:Chain Result to a given Action, and intercepting its target Action's invocation with a ChainingInterceptor.
- Redirect After Post: A common a pattern in web application development in which your action will result in a redirect to another action.
- Redirect Action Result: Uses ActionMapper provided by the ActionMapperFactory to redirect the browser to a URL that invokes the specified action. You can see a simple implementation of this in the struts-blank application. If you look at the example.xml file in the application you will can see that the Login action redirects the result to a different action "Menu".
<action name="Login!*" method="{1}" class="example.Login">
In order to send parameters, use the <param></param> tag, as shown below
<result name="input">/example/Login.jsp</result>
<result type="redirect-action">Menu</result>
</action><param name="paramname">value</param>
- Redirect Result:Calls theHttpServletResponse.sendRedirect(), (a browser redirect). The consequence of doing this means that the action (action instance, action errors, field errors, etc) that was just executed is lost and no longer available. This is because actions are built on a single-thread model. The only way to pass data is through the session or with web parameters (?name=value). In the following code, you can see that the "Menu.Action" is used instead of just Menu.
<action name="Login!*" method="{1}" class="example.Login">
<result name="input">/example/Login.jsp</result>
<result type="redirect">Menu.action</result>
</action>
- Redirect Action Result: Uses ActionMapper provided by the ActionMapperFactory to redirect the browser to a URL that invokes the specified action. You can see a simple implementation of this in the struts-blank application. If you look at the example.xml file in the application you will can see that the Login action redirects the result to a different action "Menu".
Thursday, November 09, 2006
Struts 2: Action Redirects
Struts 2.0 provides the ability to chain multiple actions into a defined sequence or workflow. Action chaining can be achieved in multiple ways:
Labels:
struts
Subscribe to:
Post Comments (Atom)
Popular Posts
-
In a previous post, I described how to use Quartz scheduler for scheduling . In this post, I describe the configuration changes required for...
-
The previous post described how to implement a JMS messaging client using Spring JMS . This post will describe how to implement the Message ...
-
This post will describe how to create and deploy a Java Web Application war to Heroku using Heroku CLI. You will need a basic understanding ...
-
JUnit 4 introduces a completely different API to the older versions. JUnit 4 uses Java 5 annotations to describe tests instead of using in...
-
New posts with iText 5.5.12 Following are two new posts for PDF Merge with iText 5.5.12 Merge PDF files using iText 5 Merge and Paginate PDF...
-
Roller is a Java based blog server. It is in Apache incubator as of now. Roller drives Sun Microsystem's blogs.sun.com employee bloggi...
-
In the previous post, I described the use of Displaytag to implement paging in a simple JSP. In this example, I describe the use of Displayt...
-
In the past, I wrote a post on how to implement Web Services using JAX-WS on Glassfish, and Apache Axis. In this post I will describe how to...
-
Redhat Enterprise Linux provides Redhat Developer Toolset , which allows you to install Git. However, it is usually an older version. If you...
-
Last week, I described how to implement JMS, using a stand-alone client and a Message Driven Bean . In this post and the next, I will descr...
Custom Steel Wheels can be found here for any make of classic hot rod or street rod
ReplyDeleteHi
ReplyDeleteThis is a nice example. But I have the following question,
"After a successful login I don't want to redirect the user to a hardcodes page, but I want the user to be redirected where he wanted to go. E.g. if a user clicks on 'sell' he will be forced to log in and after login the sell-page should be shown. If he vlicks on buy the buy-page should be shown after login. Is there an elegant way to do this?"
Hi,
ReplyDeleteI have the same problem like after a successful login I don't want user to redirect to hardcode pages but I want the user to be redirected where he come from.
please provide solution for this
I also have a same problem i have a email link which takes me to the Site where i need to login after successfull login i want the user to be taken to page that was in the link and not the hardcoded page
ReplyDeleteThanks in advance
Manish
hi
ReplyDeletein struts2 i want change the way error messages dispalying in jsp .for example displying errors messages after field right side.i tried lot things with java script and finalyy i failed.please help me .i have strucked here