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 *