create struts application in myeclipse

To create a Struts 2 application in MyEclipse, you can follow these steps:

  1. Launch MyEclipse: Open the MyEclipse IDE and create a new workspace.

  2. Create a new project: Select the "File" menu and choose "New" and then "Project". In the "New Project" dialog box, select "Web" and then "Web Project". Give a name to the project, and click "Next".

  3. Select the Struts 2 framework: In the "New Web Project" dialog, select the "Struts 2 Project" option and click "Next".

  4. Configure the Struts 2 project settings: In the "Struts 2 Project" dialog box, enter the project details such as the Struts version, package namespace, and default package location. Click "Finish" to create the project.

  5. Create an action class: Once the project is created, you can create a new Java class that extends the ActionSupport class, which provides several helper methods for processing user input. In this class, you can define a method that handles a user request and returns a result.

For example, you can create a class named HelloAction that has a method named execute() that returns a result named "success".

re‮t ref‬
package com.example;

import com.opensymphony.xwork2.ActionSupport;

public class HelloAction extends ActionSupport {

    public String execute() {
        return "success";
  1. Define the view: The view is the user interface that the user interacts with. In Struts 2, you can use JSP pages or FreeMarker templates to define the view. Create a JSP page that displays a welcome message to the user.
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
    <title>Hello World!</title>
    <h1>Hello, Struts!</h1>
  1. Configure the application: Struts 2 requires several configuration files to work correctly. You need to configure the struts.xml file to specify the application's settings and dependencies. In this file, you can define a mapping between the user request and the action class, and specify the result to be returned.
    "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"

  <package name="default" namespace="/" extends="struts-default">
    <action name="hello" class="com.example.HelloAction">
      <result name="success">/hello.jsp</result>
  1. Deploy and test the application: You can deploy the Struts 2 application on a web server such as Apache Tomcat, and test it by entering the URL of the action in a web browser.

For example, if you have named the action "hello", you can access it by entering the following URL in the browser:


This should display the welcome message on the web page.

Overall, creating a Struts 2 application in MyEclipse involves creating a new project, defining the action class, creating the view, configuring the application, and testing it. MyEclipse provides a powerful and flexible environment for building robust web applications in Java.