`
ganjuelovejava
  • 浏览: 92100 次
  • 性别: Icon_minigender_2
  • 来自: 湖南
社区版块
存档分类
最新评论

spring和ibatis集成servlet

阅读更多
package com.huawei.test.ibatis.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

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

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.huawei.test.ibatis.dto.MessageInfo;
import com.huawei.test.ibatis.service.MessageImpl;

/**
* <一句话功能简述>
* <功能详细描述>
*
* @author  zKF31134(zengfengjiao)
* Created:2010-10-15
* @since  HedEx Server V100R002C12/模块
*/
public class MessageServlet extends HttpServlet
{
   // private static WebApplicationContext context;
    private MessageImpl  getSimpleExample(){
        ApplicationContext context = new ClassPathXmlApplicationContext("com/huawei/test/ibatis/applicationContext-system.xml");
        return (MessageImpl)context.getBean("MessageServiceImpl");
       
       
        //WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext();
        //return (IMessageDAO)SpringBeans.getBean("IMessageService");
    }

    /**
    * The doGet method of the servlet. <br>
    *
    * This method is called when a form has its tag value method equals to get.
    *
    * @param request the request send by the client to the server
    * @param response the response send by the server to the client
    * @throws ServletException if an error occurred
    * @throws IOException if an error occurred
    */
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
       
        doPost(request,response);
    }
   
    /**
    * The doPost method of the servlet. <br>
    *
    * This method is called when a form has its tag value method equals to post.
    *
    * @param request the request send by the client to the server
    * @param response the response send by the server to the client
    * @throws ServletException if an error occurred
    * @throws IOException if an error occurred
    */
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        List<MessageInfo> mList = new ArrayList();
        mList = this.getSimpleExample().getAllMessage();
        System.out.println(mList.size());
       
    }
   
}
分享到:
评论

相关推荐

    spring4.3.9相关jar包

    spring-web.jar(必须) :这个jar 文件包含Web 应用开发时,用到Spring 框架时所需的核心类,包括自动载入Web Application Context 特性的类、Struts 与JSF 集成类、文件上传的支持类、Filter 类和大量工具辅助类。...

    spring 3.0 jar 所有开发包及开发项目实例

    org.springframework.orm-3.0.0.M4.jar: 整合第三方的ORM框架,如hibernate,ibatis,jdo,以及spring的JPA实现 org.springframework.transaction-3.0.0.M4.jar: 为JDBC、Hibernate、JDO、JPA等提供的一致的声明式和...

    spring-framework-3.0.0.M4-with-docs

    org.springframework.orm-3.0.0.M4.jar: 整合第三方的ORM框架,如hibernate,ibatis,jdo,以及spring的JPA实现 org.springframework.transaction-3.0.0.M4.jar: 为JDBC、Hibernate、JDO、JPA等提供的一致的声明式和...

    公司CRM客户关系管理系统(Web层和逻辑层分离).zip

    主要内容: 1,完完整整的CRM系统代码,含页面和数据库...5,技术栈:ExtJS+Servlet+Spring+Ibatis以及oscache、log4j等。 6,Web层和逻辑层分离的B/S架构 7,可供修改后商用,也可作为学习参考,也可作为毕业设计。

    公司CRM客户关系管理系统(Web层和逻辑层分离)

    主要内容: 1,完完整整的CRM系统代码,含页面和数据库...5,技术栈:ExtJS+Servlet+Spring+Ibatis以及oscache、log4j等。 6,Web层和逻辑层分离的B/S架构 7,可供修改后商用,也可作为学习参考,也可作为毕业设计。

    一份CRM客户关系管理系统的Java源代码

    主要内容: 1,完完整整的CRM系统代码,含页面和数据库脚本; 2,功能模块包括:广告,...5,技术栈:ExtJS+Servlet+Spring+Ibatis以及oscache、log4j等。 6,可供修改后商用,也可作为学习参考,也可作为毕业设计。

    Spring中文帮助文档

    6.1.2. Spring AOP的功能和目标 6.1.3. AOP代理 6.2. @AspectJ支持 6.2.1. 启用@AspectJ支持 6.2.2. 声明一个切面 6.2.3. 声明一个切入点(pointcut) 6.2.4. 声明通知 6.2.5. 引入(Introduction) 6.2.6. ...

    Spring API

    2. Spring 2.0和 2.5的新特性 2.1. 简介 2.2. 控制反转(IoC)容器 2.2.1. 新的bean作用域 2.2.2. 更简单的XML配置 2.2.3. 可扩展的XML编写 2.2.4. Annotation(注解)驱动配置 2.2.5. 在classpath中自动搜索组件...

    公司CRM客户关系管理系统(Web层和逻辑层分离)CRM103.rar

    以前在电商公司做的一套CRM系统,后来离职了,就把它奉献...5,技术栈:ExtJS+Servlet+Spring+Ibatis以及oscache、log4j等。 6,Web层和逻辑层分离的B/S架构 7,可供修改后商用,也可作为学习参考,也可作为毕业设计。

    B2C电商公司CRM客户关系管理系统(Web层和逻辑层分离)CRM103.zip

    以前在电商公司做的一套CRM系统,后来离职了,就把它奉献...5,技术栈:ExtJS+Servlet+Spring+Ibatis以及oscache、log4j等。 6,Web层和逻辑层分离的B/S架构 7,可供修改后商用,也可作为学习参考,也可作为毕业设计。

    B2C电商CRM客户关系管理系统(Web层和逻辑层分离)CRM103.zip

    以前在电商公司做的一套CRM系统,后来离职了,就把它奉献...5,技术栈:ExtJS+Servlet+Spring+Ibatis以及oscache、log4j等。 6,Web层和逻辑层分离的B/S架构 7,可供修改后商用,也可作为学习参考,也可作为毕业设计。

    springmybatis

    mybatis实战教程mybatis in action之五与spring3集成附源码 mybatis实战教程mybatis in action之六与Spring MVC 的集成 mybatis实战教程mybatis in action之七实现mybatis分页源码下载 mybatis实战教程mybatis in ...

    springmvc和mybatis集成全部jar包(全)

    springmvc4.3.3和mybatis3.4.1集成最新全部jar包,还包含了其他一些常用的jar包,很全,已经在项目中验证过。 lib/antlr-2.7.2.jar lib/aopalliance-1.0.jar lib/asm-3.3.1.jar lib/aspectjweaver-1.6.5.jar ...

    Spring面试题

    ☆ Spring ORM:Spring 框架插入了若干个 ORM 框架,从而提供了 ORM 的对象关系工具,其中包括 JDO、Hibernate 和 iBatis SQL Map。所有这些都遵从 Spring 的通用事务和 DAO 异常层次结构。 ☆ Spring Web 模块:...

    JAVA WEB典型模块与项目实战大全.part4

    第24章 数据汇聚系统(Struts 2.X+Spring+iBATIS) 第25章 投票管理系统(Struts 2.X+Spring+Hibernate) 第26章 权限管理系统(Struts 2.X+Spring+JPA) 第27章 商业银行设备巡检系统(Struts 2.X+Spring+Hibernate...

    JAVA WEB典型模块与项目实战大全.part2(第二卷)

    第24章 数据汇聚系统(Struts 2.X+Spring+iBATIS) 第25章 投票管理系统(Struts 2.X+Spring+Hibernate) 第26章 权限管理系统(Struts 2.X+Spring+JPA) 第27章 商业银行设备巡检系统(Struts 2.X+Spring+Hibernate...

    JAVA WEB典型模块与项目实战大全.part3(第三卷)

    第24章 数据汇聚系统(Struts 2.X+Spring+iBATIS) 第25章 投票管理系统(Struts 2.X+Spring+Hibernate) 第26章 权限管理系统(Struts 2.X+Spring+JPA) 第27章 商业银行设备巡检系统(Struts 2.X+Spring+Hibernate...

    JSP网络编程学习笔记源代码 part2

    第四篇为“数据库访问技术”,主要讲述JDBC技术及JSP和Servlet如何通过JDBC访问数据库,以及如何改进数据库的访问和目前流行的Hibernate、iBATIS及Spring集成访问的支持;第五篇为“标签语言和表达式语言”,主要...

    JAVA WEB典型模块与项目实战大全.part1(第一卷)

    第24章 数据汇聚系统(Struts 2.X+Spring+iBATIS) 第25章 投票管理系统(Struts 2.X+Spring+Hibernate) 第26章 权限管理系统(Struts 2.X+Spring+JPA) 第27章 商业银行设备巡检系统(Struts 2.X+Spring+Hibernate...

    JAVA WEB典型模块与项目实战大全

    3.4 实现spring、struts2.x和hibernate框架集成  3.5 小结  第2篇 典型模块开发  第4章 在线文本编辑器(fckeditor)  4.1 分析fckeditor在线文本编辑器  4.2 fckeditor在线文本编辑器初级应用  4.3 ...

Global site tag (gtag.js) - Google Analytics