Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 988863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:41:56+00:00 2026-05-16T05:41:56+00:00

Hi I am new to Struts 2 and all the java web development, I

  • 0

Hi I am new to Struts 2 and all the java web development, I created a basic struts2 application using maven and then added the struts2-rest-plugin to build my project; here is pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project>
 <modelVersion>4.0.0</modelVersion>
 <groupId>tutorial</groupId>
 <artifactId>tutorial</artifactId>
 <packaging>war</packaging>
 <version>0.1</version>
 <name>Struts 2 Starter</name>
 <url>http://www.myComp.com</url>
 <description>Struts 2 Starter</description>

 <dependencies>
  <!-- Junit -->
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>3.8.1</version>
   <scope>test</scope>
  </dependency>

  <!--  Struts 2 -->
  <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.1.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <version>2.1.6</version>
        </dependency>
        <dependency>
         <groupId>org.apache.struts</groupId>
         <artifactId>struts2-convention-plugin</artifactId>
         <version>2.1.6</version>
        </dependency>
        <dependency>
         <groupId>org.apache.struts</groupId>
         <artifactId>struts2-rest-plugin</artifactId>
         <version>2.1.6</version>
        </dependency>


  <!-- Servlet & Jsp -->
  <dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>servlet-api</artifactId>
   <version>2.4</version>
   <scope>provided</scope>
  </dependency>
  <dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>jsp-api</artifactId>
   <version>2.0</version>
   <scope>provided</scope>
  </dependency>

  <!-- Jakarta Commons -->
  <dependency>
   <groupId>commons-fileupload</groupId>
   <artifactId>commons-fileupload</artifactId>
   <version>1.1.1</version>
  </dependency>

  <!-- Dwr -->
  <dependency>
   <groupId>uk.ltd.getahead</groupId>
   <artifactId>dwr</artifactId>
   <version>1.1-beta-3</version>
  </dependency>
    </dependencies>

    <build>
      <finalName>tutorial</finalName>
     <plugins>
      <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                   <source>1.5</source>
                   <target>1.5</target>
                </configuration>
            </plugin>
      <plugin>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>maven-jetty-plugin</artifactId>
       <version>6.1.5</version>
       <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
       </configuration>
      </plugin>
     </plugins>
    </build>
</project>

the web.xml and struts.xml are as following:

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="starter" version="2.4" 
         xmlns="http://java.sun.com/xml/ns/j2ee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

 <display-name>Struts 2 - Maven Archetype - Starter</display-name>

 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath*:applicationContext*.xml</param-value>
 </context-param>

 <!-- Filters -->
    <filter>
        <filter-name>action2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        <!-- filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class-->
    </filter>

    <filter-mapping>
        <filter-name>action2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

 <!-- Listeners --> 
 <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Welcome file lists -->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

</web-app>

struts.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC 
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

 <constant name="struts.convention.action.suffix" value="Controller"/>
 <constant name="struts.convention.action.mapAllMatches" value="true"/>
 <constant name="struts.convention.default.parent.package" value="rest-default"/>
 <constant name="struts.convention.package.locators" value="example"/>

</struts>

Now I have package org.apache.struts2.rest.example with class OrdersController.java (taken from the struts2-rest-showcase example); running mvn jetty:run and hitting url: http://localhost:8080/tutorial/orders/ results in Error 404;

What’s wrong that I am doing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:41:56+00:00Added an answer on May 16, 2026 at 5:41 am

    Ok guys I found ma problem; maven by default generates a struts.properties file and these two lines are trouble:

    struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
    struts.action.extension=action

    Comment them out and XML would be effective (You investigate the rest of story)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 514k
  • Answers 514k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes we can! http://www.opensource.org/licenses/zlib-license.php This software is provided 'as-is', without… May 16, 2026 at 6:06 pm
  • Editorial Team
    Editorial Team added an answer I would simply generate two random numbers and use one… May 16, 2026 at 6:06 pm
  • Editorial Team
    Editorial Team added an answer Your syntax is almost correct. You don't need one of… May 16, 2026 at 6:06 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a Java web application that has a 'disconnected' Java Swing desktop app.
We are looking at reworking a java business management web service that has been
I'm using Java at the core backend and JSP pages as GUI frontend. and
New to Maven. Ok so I used Maven to package up my project, but
One of the projects I was in charge of as a JSP/Struts developer at
I am currently doing some work for a company that runs a legacy web
As developer, I am often interested in new language feature that can make your
Is there any difference generating a *.war file using a 64bits VM rather than
In struts2 upload methods, can I choose where the uploaded file must be saved.
i've got this problem again... So i've got String data in my Struts2 app.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.