struts2 404问题(新手) 30
第一天学struts2,然后首先可以进入登录界面login.jsp,但是点击登陆后就会出现404,怎么办?下面是具体小代码:login.java:packagecom.t...
第一天学struts2,然后首先可以进入登录界面login.jsp,但是点击登陆后就会出现404,怎么办?
下面是具体小代码:
login.java:
package com.test.action;
public class LoginAction { public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String execute() throws Exception { return "success"; } //对应表单上的 private String username; private String password;
}
struts xml:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts><package name="struts" extends="struts-default"> <action name="login" class="com.test.action.LoginAction"> <!-- result没有名字是默认的success --> <result name="success">/result.jsp</result> </action> </package>
</struts> 展开
下面是具体小代码:
login.java:
package com.test.action;
public class LoginAction { public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String execute() throws Exception { return "success"; } //对应表单上的 private String username; private String password;
}
struts xml:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts><package name="struts" extends="struts-default"> <action name="login" class="com.test.action.LoginAction"> <!-- result没有名字是默认的success --> <result name="success">/result.jsp</result> </action> </package>
</struts> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询