关于struts跳转问题 球高手

zpshwd 2012-11-06 09:34:27
login.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>login </title>
</head>
<body>

<form action="${pageContext.request.contextPath}/struts/day1/login.do" method="post">
studentName <input name="studentname" type="text"">
password <input name="password" type="password">
<input type="submit" value="login">
</form>
</body>
</html>

struts配置中
<action path="/struts/day1/login" type="com.anbow.struts.day1.action.LoginAction">
<forward name="success" path="/day1/welcome.jsp"></forward>
<forward name="error" path="/day1/error.jsp"></forward>
</action>
action中
public class LoginAction extends Action {

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionForward forward=null;
String name=request.getParameter("studentname");
String passwd=request.getParameter("password");

StudentBizImp imp=new StudentBizImp();
Student student=null;
student=imp.login(name, passwd);

if(student!=null){

forward=mapping.findForward("success");
request.setAttribute("student", student);

}else{
forward=mapping.findForward("error");
request.setAttribute("message", "this user is not exit");
}
return forward;


}

}
从 login跳转时出现 这个错误。
404 错误
。。。。。。/$%7BpageContext.request.contextPath%7D/struts/day2/login.do这个是哪里错了?
...全文
111 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
diypyh 2012-11-06
  • 打赏
  • 举报
回复
好久没用struts1了,现在都是用struts2
zpshwd 2012-11-06
  • 打赏
  • 举报
回复
我的包什麽的都对 是不是myecilips太高了??

81,114

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧