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接口

  • 相关阅读:
    linux性能测试(转)
    mysql基本操作(数据库,表,字段,记录)
    mysql数据库的简介(安装和卸载)
    mysql数据库
    枚举法
    python数据结构与算法简介
    自学心得
    python 进程线程阅读摘抄
    python并发编程多线程基础1
    python队列
  • 原文地址:https://www.cnblogs.com/xuerong/p/5037764.html
Copyright © 2011-2022 走看看