package servlet;
import imp.ListTest;
import inter.Beijing;
import java.io.IOException;
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.FileSystemXmlApplicationContext;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
public class TestServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String a = request.getParameter("text");
System.out.println("请求道德a= "+a);
WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();
ListTest b1 = (ListTest)wac.getBean("ListTest");
ListTest b2 = (ListTest)wac.getBean("ListTest");
System.out.println(b1==b2);
if(b1==null){
System.out.println("b1没有被初始化。。。。。");
}else{
System.out.println(b1.list.toString());
}
ApplicationContext ctx0 = new FileSystemXmlApplicationContext("C:/tomcat/webapps/SpringWU/WEB-INF/applicationContext.xml");
Beijing b6 = (Beijing) ctx0.getBean("ListTest");
ListTest b5 = (ListTest)ctx0.getBean("ListTest");
WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext( request.getSession().getServletContext());
ListTest b3 = (ListTest)ctx.getBean("ListTest");
ListTest b4 = (ListTest)ctx.getBean("ListTest");
System.out.println(b3==b4);
if(b3==null){
System.out.println("b1没有被初始化。。。。。");
}else{
System.out.println(b1.list.toString());
}
System.out.println(b1 == b2);
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
response.getWriter().println("您的输入为:="+a);
System.out.println("-------------------------------------------");
if(b1==b3){
System.out.println("说明 那那两种取的bean一样从web中取得");
if(b1==b5){
System.out.println("全部取出的bean都一样");
}else{
System.out.println("就b5不一样!!!");
}
}
System.out.println("-------------------------------------------");
if(b5==b6){
System.out.println("b5==b6");
}else{
System.out.println("b5!=b6");
}
System.out.println("-------------------------------------------");
// super.doPost(request, response);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SpringWU3.0.rar (49个子文件)
SpringWU
src
factory
BeingFactory.java 255B
ListSpringTest.java 969B
SpringTest.java 427B
imp
ListTest.java 270B
Cat.java 260B
Dog.java 290B
servlet
TestServlet.java 3KB
inter
Beijing.java 81B
applicationContext.xml 505B
beanPost
MybeanPostProcessor.java 540B
.project 1KB
WebRoot
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 877B
classes
factory
BeingFactory.class 564B
ListSpringTest.class 1KB
SpringTest.class 833B
imp
ListTest.class 693B
Dog.class 891B
Cat.class 894B
servlet
TestServlet.class 3KB
inter
Beijing.class 129B
applicationContext.xml 505B
beanPost
MybeanPostProcessor.class 992B
lib
spring
org.springframework.orm-3.0.3.RELEASE.jar 326KB
org.springframework.aop-3.0.3.RELEASE.jar 313KB
org.springframework.test-3.0.3.RELEASE.jar 200KB
org.springframework.expression-3.0.3.RELEASE.jar 156KB
org.springframework.oxm-3.0.3.RELEASE.jar 59KB
org.springframework.jdbc-3.0.3.RELEASE.jar 371KB
org.springframework.beans-3.0.3.RELEASE.jar 541KB
org.springframework.context.support-3.0.3.RELEASE.jar 98KB
org.springframework.web-3.0.3.RELEASE.jar 380KB
org.springframework.aspects-3.0.3.RELEASE.jar 29KB
org.springframework.web.servlet-3.0.3.RELEASE.jar 395KB
org.springframework.spring-library-3.0.3.RELEASE.libd 1KB
org.springframework.instrument.tomcat-3.0.3.RELEASE.jar 6KB
org.springframework.web.struts-3.0.3.RELEASE.jar 31KB
commons-logging.jar 52KB
org.springframework.core-3.0.3.RELEASE.jar 357KB
org.springframework.instrument-3.0.3.RELEASE.jar 2KB
org.springframework.asm-3.0.3.RELEASE.jar 52KB
org.springframework.jms-3.0.3.RELEASE.jar 180KB
org.springframework.transaction-3.0.3.RELEASE.jar 226KB
org.springframework.context-3.0.3.RELEASE.jar 647KB
org.springframework.web.portlet-3.0.3.RELEASE.jar 168KB
applicationContext.xml 505B
index.jsp 1KB
.mymetadata 297B
.classpath 3KB
.myeclipse
共 49 条
- 1
资源评论
- te2341414tao2013-06-24被吭了,只是spring的一个小程序,不是spring testcontect
- Marln2012-11-30以为是跟junit 的test对相的jar
- jiabo40770092012-11-27不是想要的,以为是跟junit 的test对相的jar
- bingfengfzl2012-03-17被吭了,只是spring的一个小程序,不是spring testcontect
wuxiaoxu666
- 粉丝: 2
- 资源: 73
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- loco-config 仓库的 `/rpi-config-files`
- EV charging scheduling based on Lagrange distributed algorithm
- test1111111
- 一个简单的Delphi控制台应用程序,它打印出"Hello, World!"
- 基于网络爬虫及用户的协同过滤推荐算法的电影推荐系统+源代码+文档说明
- 使用Spark的DataFrame接口实现基于美国加州 1990 年房屋普查的数据集的线性回归模型实现的房价预测+源代码文档说明
- 基于spark的数据分析算法,已有1:找出树状数据表中的所有路径与其相应的权重(代价)算法+源代码+文档说明
- 通信管道工程监理实施细则.doc
- 游戏开发程序游戏开发程序代码
- 反向器构成的施密特触发器
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功