tumblr counter

Struts 2 Example

Struts 2 Example explains step by step example of configuring Struts 2 with eclipse

Apache Struts 2, is a popular Java Model-View-Contraller (MVC) framework, which is developed by merging WebWork and Struts 1.x web frameworks.

Struts 2 have lot off difference with struts 1, struts 2 have implemented with an idea of convention over configuration, it also have many annotations in order to increase the developer productivity.

Features like interceptors, OGNL expression & value stack model are some of the benefits, you will get when you are developing with struts 2


When you deploy your struts 2 web application, you may get FilterDispatcher is deprecated! Please use the new filters! warning message, this is because FilterDispatcher filter is deprecated since Struts version 2.1.3, you need to re-configure your application with StrutsPrepareAndExecuteFilter

Required Libraries
  1. JDK 6
  2. Eclipse 3.7
  3. struts-

Following jar must be in classpath

  1. commons-fileupload-1.3.jar
  2. commons-io-2.0.1.jar
  3. commons-lang3-3.1.jar
  4. commons-logging-1.1.3.jar
  5. freemarker-2.3.19.jar
  6. javassist-3.11.0.GA.jar
  7. ognl-3.0.6.jar
  8. struts2-core-
  9. xwork-core-

You can see the project structure below

Struts 2 Example


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
	<s:form action="HelloUser">
		<s:textfield name="Name" label="Name" />
		<s:submit />


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
		<s:property value="message" />

1 2 Next

Your email address will not be published. Required fields are marked *