After JSP, I began to learn Struts2 in my class. Like before, I decide to write a tutorial about how to set up a basic struts2 project in Eclipse. I assume you already can set up a JSP project in Eclipse in the following steps.

Setting up Struts2 projects is a little bit harder than JSP one. I mainly learnt from these following 2 links:

Here I modify the project in the first link a little to make this example project. You may download this first to see if it actually works.

# Set up Normal JSP Project

Create a dynamic web project as my previous tutorial.

# Convert Project into Maven Project

Right click the project and select “Configure - Convert to Maven Project”.

Add two dependencies into your pom.xml: struts2-core and struts2-convention-plugin. Currently I am using version 2.5.16. If I guess correct, that convention plugin is used to replace struts2.xml.

This class is used to replace web.xml.
Notice it seems that you have to put actions into a package named actions. Otherwise, the struts2 framework will not recognize it, even if you have already added annotations. I think this is that “convention” thing. If have time, search for it.