zoukankan      html  css  js  c++  java
  • WebApplicationContext wac=WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());这句话的意思

    在jsp中出现

    提取的代码:

    <%
       WebApplicationContext wac = WebApplicationContextUtils
         .getWebApplicationContext(this.getServletContext());
       UserDao userDao = (UserDao) wac.getBean("userDaoImpl");
       String in=(String)request.getParameter("id");
      System.out.println(in);
       int num=Integer.parseInt(in);   
      %>
     <%=userDao.findUserById(num)%><br />

    WebApplicationContext wac=WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
    WebApplicationContext 是什么?
    WebApplicationContextUtils是什么?
    this.getServletContext()又是什么?

    这句话的意思是,通过WebApplicationContextUtils工具类获取ApplicationContext对象.这个对象是通过.getServletContext()方式获取的,然后把获取的ApplicationContext对象赋值给wac。

    WebApplicationContext是spring包中的一个类
    WebApplicationContextUtils是Spring 包中的一个工具类
    getServletContext()是struts2中获取参数的方法

  • 相关阅读:
    Fluxbox 1.0 RC 2
    Cairo 1.2.0
    Transmission 0.6.1
    Xara LX Xtreme 0.5 Rev1175
    Totem 1.4.2
    ImageMagick 6.2.81
    恢复 Firefox 和 Thunderbird 图标
    Conky 1.4.2
    BitTorrent 4.20.0
    Geany 疾速简便的集成启示情况
  • 原文地址:https://www.cnblogs.com/fifiyong/p/5803236.html
Copyright © 2011-2022 走看看