<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    少年阿賓

    那些青春的歲月

      BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
      500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

    //web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="  <display-name>struts</display-name>
     
      <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/classes/struts-config.xml</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>3</param-value>
        </init-param>
        <init-param>
          <param-name>detail</param-name>
          <param-value>3</param-value>
        </init-param>
        <load-on-startup>0</load-on-startup>
      </servlet>
     
       <servlet-mapping>
         <servlet-name>action</servlet-name>
         <url-pattern>*.do</url-pattern>
       </servlet-mapping>
     
     <!--  
       <jsp-config>
        <taglib>
         <taglib-uri>/WEB-INF/struts-html</taglib-uri>
         <taglib-location>WEB-INF/struts-html.tld</taglib-location>
        </taglib>
        <taglib>
         <taglib-uri>/WEB-INF/struts-bean</taglib-uri>
         <taglib-location>WEB-INF/struts-bean.tld</taglib-location> 
        </taglib> 
        <taglib>
         <taglib-uri>/WEB-INF/struts-logic</taglib-uri>
         <taglib-location>WEB-INF/struts-logic.tld</taglib-location>
        </taglib> 
       
       </jsp-config>
      -->  
     
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
    </web-app>

     

     

    //struts-config.xml這個(gè)放置在src目錄下面

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "

    <struts-config>
      <form-beans >
        <form-bean name="userForm" type="com.abin.struts1.form.UserForm" ></form-bean>
      </form-beans>
      <global-exceptions />
      <global-forwards />
      <action-mappings >
        <action
          path="/userAction"
          type="com.abin.struts1.action.UserAction"
          name="userForm"
          parameter="method"
          scope="request"
          validate="true"
          input="/add.jsp"
          >
          <forward name="add" path="/index.jsp"/>
       </action>
      </action-mappings>
      <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
    </struts-config>

     

     

     

    //UserAction.java

    package com.abin.struts1.action;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.actions.DispatchAction;

    import com.abin.struts1.form.UserForm;

    public class UserAction extends DispatchAction {

     public ActionForward user(ActionMapping mapping, ActionForm form,
       HttpServletRequest request, HttpServletResponse arg3) throws Exception {
      UserForm userForm = (UserForm) form;
      String un = userForm.getUsername();
      String pw = userForm.getPassword();
      
      System.out.println("username="+un);
      System.out.println("password="+pw);
      
      return mapping.findForward("add");
     }

    }

     

     

    //UserForm.java

    package com.abin.struts1.form;

    import org.apache.struts.action.ActionForm;

    public class UserForm extends ActionForm{
     private int id;
     private String username;
     private String password;
     
     public int getId() {
      return id;
     }
     public void setId(int id) {
      this.id = id;
     }
     public String getUsername() {
      return username;
     }
     public void setUsername(String username) {
      this.username = username;
     }
     public String getPassword() {
      return password;
     }
     public void setPassword(String password) {
      this.password = password;
     }
     
     
    }

     

     

    //index.jsp這個(gè)放置在WebContent下面(我這里使用的eclipse,如果是Myeclipse就直接放置在WebRoot下面)

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>struts1.3 test</title>
    </head>
    <body>
     <a href="add.jsp" target="_blank" >新增</a>
    </body>
    </html>

     

     

    //add.jsp這個(gè)放置在WebContent下面(我這里使用的eclipse,如果是Myeclipse就直接放置在WebRoot下面)

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>struts1.3 test</title>
    </head>
    <body>
     <form action="userAction.do" method="post">
      <input type="hidden" name="method" value="user" />
      用戶名:<br/>
      <input type="text" name="username" id="username" /><br/>
      密碼:<br/>
      <input type="text" name="password" id="password" /><br/>
      <input type="submit" value="提交" />
      <input type="reset" value="重置"/>
     
     </form>
    </body>
    </html>


    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: a级片在线免费看| 一本色道久久88亚洲精品综合| 亚洲乱人伦中文字幕无码| 性色午夜视频免费男人的天堂| 亚洲人成网站在线观看青青| 免费看一级高潮毛片| 午夜国产羞羞视频免费网站| 亚洲乱人伦中文字幕无码| 精品国产麻豆免费网站| 亚洲av无码一区二区三区四区 | 99热这里有免费国产精品| 久久青青草原亚洲AV无码麻豆 | 亚洲国产精品久久久久| 久久久久久国产精品免费免费男同 | 亚洲AV性色在线观看| 日韩在线看片免费人成视频播放| 亚洲精品理论电影在线观看| 啦啦啦手机完整免费高清观看| 亚洲欧洲av综合色无码| 午夜电影免费观看| 国产综合成人亚洲区| 免费va人成视频网站全| 精品国产呦系列在线观看免费 | 免费国产污网站在线观看| 久久国产精品亚洲综合| 黄色免费网站网址| 亚洲精品成a人在线观看夫| 免费jlzzjlzz在线播放视频| 怡红院免费的全部视频| 亚洲成年人免费网站| 日韩免费观看一级毛片看看| 黄色网址免费在线观看| 亚洲黄色在线播放| 国产猛烈高潮尖叫视频免费| a级成人毛片免费图片| 亚洲剧场午夜在线观看| 国产99视频免费精品是看6| 国产精品免费无遮挡无码永久视频 | 亚洲另类图片另类电影| 免费在线观看理论片| 99爱在线观看免费完整版|