As part of struts project we need to implement several Action classes to take care of various tasks.

Action class is a sub class of org.apache.struts.action.Action


  1. Configure Struts in web.xml class.
  2. Create a ActionOne class that extends Actison class.
  3. Configure ActionOne class in struts-config.xml
  4. Deploy & Run the application.


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns=""

package com.java2learn.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class ActionOne extends Action {
	public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)throws Exception{
		System.out.println("*****************ActionOne::execute() method************************");
		return null;
	public ActionOne(){
		System.out.println("ActionOne is created.");



<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts-config PUBLIC
	  "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"

		<action  path="/HelloWorld" type="com.java2learn.action.ActionOne">

ActionOne class is mapped to the path /HelloWorld

Package Structure

package structure



Download Project(With jars): StrutsSample



The following steps will be carried out in the server when it receives the request with

  1. WC starts the execution of ActionServlet code (struts code).
  2. Struts code checks for the Action class mapped to the path (ActionOne)
  3. If required ActionOne object will be created by struts code.
  4. Struts code calls the execute method.
  5. As the execute method returns null, struts will stop processing the request.