下面是web.xml
<?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
"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
"
id="WebApp_ID" version="3.0">
<display-name></display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
下面是struts.xml,struts.xml是放在src目录下的
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd
">
<struts>
<package name="default" namespace="/" extends="struts-default">
</package>
<package name="users" namespace="/users" extends="struts-default">
<action name="Users_login" class="action.UsersAction" method="login">
<result name="login_success">/users/Users_login_success.jsp</result>
<result name="login_failure">/users/Users_login.jsp</result>
<allowed-methods>login</allowed-methods>
</action>
</package>
</struts>
下面jsp是提交表格的,点击提交之后就会显示没有action映射
There is no Action mapped for action name Users_login.
<form name="Users_login" action="Users_login.action" method="post">
<!-- start of login form -->
<div id="welcome">
<span id="welcome-text">管 理 登 录</span>
</div>
<div id="user-name">
<span class="item">用户名:</span>
<span><input type="text" name="username" class="form-input"></span>
</div>
<div id="user-password">
<span class="item">密 码:</span>
<span class="input"><input type="password" name="password" class="form-input"></span>
</div>
<div id="button-group">
<input type="submit" class="btn" value="登录"/>
<input type="reset" class="btn" value="重置"/>
</div>
刚开始学求大佬帮忙
<?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
"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
"
id="WebApp_ID" version="3.0">
<display-name></display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
下面是struts.xml,struts.xml是放在src目录下的
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd
">
<struts>
<package name="default" namespace="/" extends="struts-default">
</package>
<package name="users" namespace="/users" extends="struts-default">
<action name="Users_login" class="action.UsersAction" method="login">
<result name="login_success">/users/Users_login_success.jsp</result>
<result name="login_failure">/users/Users_login.jsp</result>
<allowed-methods>login</allowed-methods>
</action>
</package>
</struts>
下面jsp是提交表格的,点击提交之后就会显示没有action映射
There is no Action mapped for action name Users_login.
<form name="Users_login" action="Users_login.action" method="post">
<!-- start of login form -->
<div id="welcome">
<span id="welcome-text">管 理 登 录</span>
</div>
<div id="user-name">
<span class="item">用户名:</span>
<span><input type="text" name="username" class="form-input"></span>
</div>
<div id="user-password">
<span class="item">密 码:</span>
<span class="input"><input type="password" name="password" class="form-input"></span>
</div>
<div id="button-group">
<input type="submit" class="btn" value="登录"/>
<input type="reset" class="btn" value="重置"/>
</div>
刚开始学求大佬帮忙