RATTLESNAKE
RATTLESNAKE

Reputation: 3228

Java Struts2 Action map issue

I am new to struts2 and trying to learn very awesome struts2 framework.

But I am stucked to a very critical issue as mentioned: There is no Action mapped for namespace / and action name Struts2Example1.

I am using IntelliJ IDE and the content of my web.xml is:

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

    <display-name>Struts2Example2</display-name>

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

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

    <welcome-file-list>
        <welcome-file>index.jsp</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>
</struts>

Can anybody help me to get rid of this error.

Thanks

Upvotes: 0

Views: 581

Answers (1)

Umesh Awasthi
Umesh Awasthi

Reputation: 23587

The best way to learn a new framework is to download some sample applications from the struts2 official website, check them how they are configured and how they are running Download Example Applications:

And what you have described in your query it seems there is some mapping issues with your config file more over the struts.xml file you have provided do not include any mapping entry, so its always better to provide complete details

Upvotes: 2

Related Questions