package cn.itcast.servlet;
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.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import cn.itcast.service.UserService;
public class UserServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
/*ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"applicationContext.xml");*/
WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
UserService userService = (UserService) applicationContext
.getBean("userService");
userService.sayHello();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
在Web项目中集成Spring
共33个文件
jar:9个
xml:4个
prefs:3个
需积分: 28 8 下载量 24 浏览量
2018-04-18
09:08:40
上传
评论
收藏 3.66MB ZIP 举报
温馨提示
在Web项目中集成Spring,在Web项目中集成Spring,在Web项目中集成Spring
资源推荐
资源详情
资源评论
收起资源包目录
SpringWeb.zip (33个子文件)
SpringWeb
src
applicationContext.xml 438B
cn
itcast
service
UserService.java 140B
test
SpringTest.java 581B
servlet
UserServlet.java 1KB
log4j.properties 663B
.classpath 607B
.mymetadata 324B
.settings
com.genuitec.eclipse.j2eedt.core.prefs 1KB
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.ws.service.policy.prefs 87B
org.eclipse.wst.common.component 463B
.jsdtscope 500B
org.eclipse.jdt.core.prefs 670B
.myeclipse
.project 2KB
WebRoot
META-INF
MANIFEST.MF 36B
index.jsp 834B
WEB-INF
classes
applicationContext.xml 438B
cn
itcast
service
UserService.class 530B
test
SpringTest.class 852B
servlet
UserServlet.class 1KB
log4j.properties 663B
lib
spring-web-3.2.0.RELEASE.jar 610KB
spring-test-3.2.0.RELEASE.jar 441KB
com.springsource.org.apache.commons.logging-1.1.1.jar 60KB
spring-beans-3.2.0.RELEASE.jar 591KB
servlet-api.jar 238KB
com.springsource.org.apache.log4j-1.2.15.jar 387KB
spring-expression-3.2.0.RELEASE.jar 189KB
spring-core-3.2.0.RELEASE.jar 843KB
spring-context-3.2.0.RELEASE.jar 834KB
web.xml 1KB
共 33 条
- 1
资源评论
Java秦老师
- 粉丝: 8510
- 资源: 90
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功