dl页面;
<h1>用户登录</h1> <hr> <form action="<%=path %>/yz!login.action" method="post"> 用户名<input type="text" name="name"> 密码<input type="password" name="password"> <input type="submit" value="登录"> </form> hy页面; <a href="<%=path %>/yz!reglster.action">退出</a>
Action ;
package com.st.action; import com.opensymphony.xwork2.ActionSupport; public class YzAction extends ActionSupport { public String login() throws Exception { System.out.println("login"); return "loginok"; } public String reglster() throws Exception { System.out.println("reglster"); return "reglsterok"; } }
struts.xml;
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="denlu" namespace="/" extends="struts-default"> <action name="yz" class="com.st.action.YzAction"> <result name="loginok">/WEB-INF\hy.jsp</result> <result name="reglsterok">/WEB-INF\dl.jsp</result> </action> </package> </struts>