Struts2 配置问题 找不到action 50
--struts.xml:<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstrutsPUBLIC"-//ApacheSoftw...
--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> <package name="struts2" extends="struts-default"> <action name="loginAction" class="com.struts2.LoginAction.class" method="execute"> <result name="success">/welcome.jsp</result> <result name="login">/login.jsp</result> </action> </package></struts>
--web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</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>
--login.jsp
<s:form id="login" action="/loginAction" method="post"> <s:label value="系统登陆" id="login1"></s:label> <s:textfield name="username" label="账号" id="username" /> <s:password name="password" label="密码" id="password" /> <s:submit name="sbumit1" value="登录" /> </s:form>
点击登录之后出现下面现象: 展开
<?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> <package name="struts2" extends="struts-default"> <action name="loginAction" class="com.struts2.LoginAction.class" method="execute"> <result name="success">/welcome.jsp</result> <result name="login">/login.jsp</result> </action> </package></struts>
--web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</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>
--login.jsp
<s:form id="login" action="/loginAction" method="post"> <s:label value="系统登陆" id="login1"></s:label> <s:textfield name="username" label="账号" id="username" /> <s:password name="password" label="密码" id="password" /> <s:submit name="sbumit1" value="登录" /> </s:form>
点击登录之后出现下面现象: 展开
2个回答
展开全部
表单里的action属性值不要加/
追问
好像还是没有效果呀,之前我也好像这样试过。再帮忙看看呗。
追答
你项目应该需要有一个应用路径http://xxx:8088/xxx/action名
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-17
展开全部
/部署名/loginAction
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询