zoukankan      html  css  js  c++  java
  • Struts框架的使用初步

    Struts框架的使用初步:
    A:Apache下载struts.2.1.8.rar包。

    B:解压空工程,进入apps目录。

    C:将struts2的基本jar包拷到工程的lib目录中。

    D:配置web.xml,加载struts2的过滤器

    E:加载struts的配置文件struts.xml到src目录。

    F:开发Struts中的Action类。并且类中必须有execute方法。
    exeucte是用于执行用户请求和响应用户的操作。

    G:将Action类配置到struts.xml中。
    <package name="default" namespace="/" extends="struts-default">
    <default-action-ref name="index" />
    <action name="helloAction" class="com.action.HelloAction">
    <result name="succ">/succ_result.jsp</result>
    </action>
    </package>

    H:页面访问Action,执行exceute方法,根据execute方法的返回值到Action到result中
    进行名称的匹配,从而请求转发或者重定向到页面。

    Struts框架的流程

    A:浏览器发送请求:/Struts2_Project_1/testFirstAction

    B:过滤器接收接求,然后将请求的路径与struts.xml中的action name进行匹配。

    C:如果匹配,将开始执行过滤器链,请求中的数据将一个一个通过过滤链中的每一个拦截器。

    D:开始执行Action中的execute方法。

    F:execute方法返回result响应类型。(请求转发,重定向页面)

  • 相关阅读:
    python-Web-django-路由保护
    python-Web-django-图表统计
    python-linux-集群nginx
    python-Web-数据库-oracle
    python-Web-数据库-mysql
    python-爬虫-scrapy
    Educational Codeforces Round 90 (Rated for Div. 2) A~C
    leetcode周赛192
    Codeforces Round #597 (Div. 2) C dp
    Codeforces Round #645 (Div. 2) A~D
  • 原文地址:https://www.cnblogs.com/ziq711/p/6364698.html
Copyright © 2011-2022 走看看