A Techno Blog, mainly about Java

Struts2 Samples

I downloaded Struts2 (2.0.1) for first time after experimenting with webworks.

My experience at this point with struts2/webworks is limited.

I figured I would start from scratch rather than migrating some old code.

The sample apps they have are

User List

Contents of  struts2-blank-2.0.1 war (folders in bold):

—    ExampleSupport extends com.opensymphony.xwork2.ActionSupport
— HelloWorld extends ExampleSupport
– struts.devMode = true
                                  struts.enable.DynamicMethodInvocation = false

– struts.xml:  <!DOCTYPE struts PUBLIC
                     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
… <include file="example.xml"/>

– example.xml: <!DOCTYPE struts PUBLIC
                     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
<package name="example" namespace="/example" extends="struts-default">

<action name="HelloWorld" class="example.HelloWorld">
                       <action name="Login!*" method="{1}" class="example.Login">
                            <result name="input">/example/Login.jsp</result>
                           <result type="redirect-action">Menu</result>
                      <action name="*" class="example.ExampleSupport">


— commons-collections-3.1

— freemarker-2.3.4

— spring-aop-1.2.8

— spring-context-1.2.8

— spring-web-1.2.8

— struts2-core-2.0.1

— commons-logging-1.0.4

— ognl-2.6.7

— spring-beans-1.2.8

— spring-core-1.2.8

— struts2-api-2.0.1

— xwork-2.0-beta-1

The Struts 2  home page states the Struts 2 requires  Java 5. However, an alternate set of jars for  Java 1.4.x are available.  The challenge here is for people using Java 1.4.X is that the sample apps  come with the Java 5 jars.The java 4 jars can be found here.  I extracted them to here:


But, the only file I needed from here was struts2-extras-j4-2.0.0.jar .

copy C:\java\struts2\struts-2.0.1\j4\struts2-extras-j4-2.0.0.jar

as I got the backport files from the nightlies:

which i copied to


Then i modified the translate.bat as follows:

java -jar retrotranslator-transformer-1.0.8.jar -srcjar struts2-core-2.0.1.jar -destjar struts2-core-j4-2.0.1.jar
java -jar retrotranslator-transformer-1.0.8.jar -srcjar struts2-api-2.0.1.jar -destjar struts2-api-j4-2.0.1.jar 
java -jar retrotranslator-transformer-1.0.8.jar -srcjar xwork-2.0-beta-1 -destjar xwork-2.0-j4.jar

The key thing is after the translate takes place to remove the following files:

  • struts2-core-2.0.1.jar
  • struts2-api-2.0.1.jar
  • xwork-2.0-beta-1

Again, a Java 5 version of struts2-extras-j4-2.0.0.jar was not in the struts2-blank-2.0.1 war.
In Summary, my lib folder contains the following jars for 1.4.x:

— commons-collections-3.1
— commons-digester-1.6
— commons-logging-1.0.4

— freemarker-2.3.4

— spring-aop-1.2.8

— spring-context-1.2.8

— spring-web-1.2.8

— retrotranslator-runtime-1.0.8
— retrotranslator-transformer-1.0.8

— ognl-2.6.7

— spring-beans-1.2.8

— spring-core-1.2.8

— struts2-core-j4-2.0.1

— struts2-api-j4-2.0.1

— xwork-2.0-j4
— backport-util-concurrent
— translate.bat

Refer to this issue here

November 24, 2006 - Posted by | Struts

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: