为了账号安全,请及时绑定邮箱和手机立即绑定

登录时出现404 报错There is no Action mapped for namespace / and action name login.

登录时出现404 报错There is no Action mapped for namespace / and action name login.

枫夜流萤 2018-05-19 12:02:48
<?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="struts" extends="struts-default"> <action name="login" class="action.LoginAction"> <result name="SUCCESS">/index.jsp</result> <result name="ERROR">/login.jsp</result> </action> </package></struts><%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <base href="<%=basePath%>">        <title>登录</title>    <meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0">    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">-->  </head>    <body><form action="login.action" method = "post">  用户名:<input type = "text" name = "username"><br>    密码:<input type = "password" name ="password"><br>    <input type = "submit" value = "登录"><br>    </form>      </body></html>package action;import vo.User;import dao.impl.*;import com.opensymphony.xwork2.ActionSupport;public class LoginAction extends ActionSupport{ private User user; String uer = user.getName(); String pas = user.getPassword(); public String execute() throws Exception{ System.out.println("action"); boolean validated = false; userDao ud = new userDao(); ud.validateUser(uer, pas); if(ud!=null){ validated=true; } if(validated){ return SUCCESS; }else{ return ERROR; } }}
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1174 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信