zoukankan      html  css  js  c++  java
  • Struts2中使用Servlet API步骤

    Struts2中使用Servlet API步骤

       Action类中声明request等对象

         Map<String, Object> request;

       获得ActionContext实例

         ActionContext ac=ActionContext.getContext();

       获取request等对象

         request=(Map<String, Object>)ac.get("request");

       在request等对象中保存数据

         request.put("loginAccess", "登录地点是:北京");

         request.get("loginAccess");

       在页面中获取保存数据提倡的方式

         <s:property value="#request.loginAccess"/>访问Servlet API

    其它方式访问Servlet API

       之前获得Servlet API对象的方式

      自己获得request: ac.get("request")

    Structs2=Structs1的知名度和市场+WebWork的技术                把字符串转成OGRL表达式%{}

      自己获得session: ac.getSession()

       让“别人”为你提供Servlet API的对象

      通过实现相应接口获得Servlet API对象

      获得request需要实现RequestAware接口

      获得session需要实现SessionAware接口

      获得application需要实现ApplicationAware接口

  • 相关阅读:
    poj 1611 The Suspects
    POJ 2236 Wireless Network
    POJ 1703 Find them, Catch them
    poj 1733 Parity game
    hdu 1598 find the most comfortable road
    cmake的使用二:链接第三方静态库
    线段树基础
    迪杰斯特拉算法
    Floyd详解
    STL中的set使用方法详细
  • 原文地址:https://www.cnblogs.com/xuerong/p/5037764.html
Copyright © 2011-2022 走看看