Long live classic Struts 1 framework, in this tutorial, we will show you how to develop a Struts 1.x web application in Google App Engine (GAE) environment.

Tools and technologies used :

  1. JDK 1.6
  2. Eclipse 3.7 + Google Plugin for Eclipse
  3. Google App Engine Java SDK
  4. Struts 1.3.10
You may also interest at this Google App Engine + Struts 2 example.

This example is going to merge Struts 1.x hello world example with this GAE + Java example.

1. New Web Application Project

In Eclipse, create a new Web Application project, named as “StrutsGoogleAppEngine”.

struts1 on gae example

Google Plugin for Eclipse will generate a sample GAE project structure. later will integrate Struts 1 into this GAE structure.

2. Integrate Struts 1.x Libraries

Visit this link to download Struts 1.x. Following jars are required :

  • antlr-2.7.2.jar
  • commons-beanutils-1.8.0.jar
  • commons-chain-1.2.jar
  • commons-digester-1.8.jar
  • commons-logging-1.0.4.jar
  • commons-validator-1.3.1.jar
  • oro-2.0.8.jar
  • struts-core-1.3.10.jar
  • struts-taglib-1.3.10.jar

Copy and put it in “war/WEB-INF/lib” folder.

struts1 on gae example library

Right click on the project folder, select “Properties“. Select “Java Build Path” -> “Libraries” tab, click “Add Jars” button and select above 9 jars from “war/WEB-INF/lib” folder into the build path.

struts1 on gae example java build

3. Integrate Struts 1.x Action and Form

3.1 Delete StrutsGoogleAppEngineServlet.java , you don’t need this.

3.2 Create a new Action class.

File : src/com/mkyong/action/HelloWorldAction.java

package com.mkyong.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;

import com.mkyong.form.HelloWorldForm;

public class HelloWorldAction extends Action {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response)
		throws Exception {

		HelloWorldForm helloWorldForm = (HelloWorldForm) form;
		helloWorldForm.setMessage("Hello World!");

		return mapping.findForward("success");


3.3 Create a new form class.

File : src/com/mkyong/form/HelloWorldForm.java

package com.mkyong.form;

import org.apache.struts.action.ActionForm;

public class HelloWorldForm extends ActionForm {

	String message;

	public String getMessage() {
		return message;

	public void setMessage(String message) {
		this.message = message;


4. Integrate Struts 1.x JSP Pages

4.1 Create HelloWorld.jsp page and put in “war/User/pages/HelloWorld.jsp“.

File : HelloWorld.jsp

<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>

	   Google App Engine + Struts 1.x example
	<h2><bean:write name="helloWorldForm" property="message" /></h2>

5. Struts XML configuration

Create a struts-config.xml file, and put it in “war/WEB-INF/struts-config.xml“.

File : struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" 


	   <form-bean name="helloWorldForm" type="com.mkyong.form.HelloWorldForm" />

	   <action path="/helloWorld" type="com.mkyong.action.HelloWorldAction"
		<forward name="success" path="/HelloWorld.jsp" />



6. web.xml

Update web.xml, integrate Struts.

File : web.xml

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"




7. Enable Session in GAE

Update appengine-web.xml, enable session support, Struts need this.

File : appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">


If you don’t enable session in GAE, you will hit error “java.lang.RuntimeException: Session support is not enabled in appengine-web.xml“.

8. Directory Structure

Review the final directory structure.

struts1 on gae example final directory structure

9. Run on Local

Right click on the project, run as “Web Application“.

URL : http://localhost:8888/helloWorld.do

struts1 on gae example run on local

10. Deploy on GAE

Update appengine-web.xml file, add your App Engine application ID.

File : appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">



Select project, click on Google icon, “Deploy to App Engine“.

URL : http://mkyong-strutsgae.appspot.com/helloWorld.do

struts1 on gae example deploy on gae
Not much problem, just follow GAE directory structure, at least integrate Struts 1 is more easily than Struts 2.

Download Source Code

Due to large file size, all Struts1 jars are excluded, you need to download it manually.

Download – StrutsGoogleAppEngine (13 KB)


  1. Struts hello world example
  2. Google App Engine + Java hello world example, using Eclipse
  3. Download Struts 1.x