Java Struts2 Action map issue
I am new to struts2 and trying to learn very awesome struts2 fra开发者_如何学运维mework.
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
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
精彩评论