ForwardAction Example in Struts

In my previous hello world program we see that action class is taking the responsibility to forward the request(i.e return ActionForward type object) . Instead of writing  our action class we can use the utility class i.e special Action given by struts famework. i.e org.apache.struts.actions.ForwardAction.

Let us have a small example below.

we didn’t write  any FormBean or Action class in this example.

1. Configure the Maven dependencies in pom.xml

2.web.xml

3. Configuration in Struts-config.xml

If you see in the below config file we have configured the org.apache.struts.actions.ForwardAction , what ever the request uri “/forward.do” will call this ForwardAction and will reneder the “success.jsp” to the client.

 4. write success.jsp

5. Project structure

StrutsForwardAction

OUT PUT:

Access the url like http://localhost:8080/StrutsForwardExample/forward.do

StrutsForwardAction_o

 

 

Download  Source Code

Posted in struts and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">