zoukankan      html  css  js  c++  java
  • 第一个分派struts2实例

    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>
    
     
    View Code

    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";
    
     }
    
    
    }
    View Code

    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-INFhy.jsp</result>
       <result name="reglsterok">/WEB-INFdl.jsp</result>
      </action>
     
     </package> 
     
    </struts>    
    View Code
  • 相关阅读:
    动手动脑感想
    原码反码补码
    java测试感想
    报告
    假期报告
    假期报告
    java学习进度
    《大道至简》读后感
    2020/1/31 PHP代码审计之目录穿越漏洞
    [极客大挑战 2019]BabySQL
  • 原文地址:https://www.cnblogs.com/laohan110/p/3524978.html
Copyright © 2011-2022 走看看