-
配置好struts2环境后
LoginAction
package com.login.action; public class LoginAction { public String checkLogin() { System.out.println("checkLogin"); return "login"; }}
LogoutAction
package com.login.action; public class LogoutAction { public String checkLogout() { System.out.println("checkLogout"); return "logout"; }}
struts-itcast.xml
/loginSuc.jsp /logoutSuc.jsp /Error.jsp
struts.xml
Error.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ taglib prefix="s" uri="/struts-tags"%>Error Error
F login.jsp<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ taglib prefix="s" uri="/struts-tags"%> login
loginSuc.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ taglib prefix="s" uri="/struts-tags"%>login success Login Success!
logout.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ taglib prefix="s" uri="/struts-tags"%> logout
logSuc.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ taglib prefix="s" uri="/struts-tags"%>logout success Logout Success!