Struts2 Hello World in Eclipse

Struts2 Hello World Example in Eclipse

Below Example use struts2.3.X version

Project Structure

Strut2 Hello File Structure


Struts2 Eclipse Hello World

Welcome To Struts 2!

Hello World



Hello World!



Struts2 Eclipse Hello*






package org.apache.struts.helloworld.action;

import org.apache.struts.helloworld.model.MessageStore;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorldAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	 * The model class that stores the message
	 * to display in the view.
	private MessageStore messageStore;
	 * Creates the MessageStore model object and 
	 * returns success.  The MessageStore model
	 * object will be available to the view.
	 * (non-Javadoc)
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	public String execute() throws Exception {
		messageStore = new MessageStore() ;
		return SUCCESS;

	public MessageStore getMessageStore() {
		return messageStore;

	public void setMessageStore(MessageStore messageStore) {
		this.messageStore = messageStore;



package org.apache.struts.helloworld.model;

public class MessageStore {
	private String message;
	public MessageStore() {
		setMessage("Hello Struts User");

	public String getMessage() {
		return message;

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







 Struts2 Hello World


Download Struts2 Hello Program