package com.sample.web;
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 com.sample.service.IService;
public class SampleServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
WebApplicationContext context = WebApplicationContextUtils
.getWebApplicationContext(req.getSession().getServletContext());
IService service = (IService) context.getBean("test");
resp.getWriter().write(service.search(req.getParameter("code")));
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req, resp);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
sample.zip (37个子文件)
Sample
META-INF
MANIFEST.MF 113B
.settings
org.eclipse.wst.common.project.facet.core.xml 181B
org.eclipse.virgo.ide.runtime.core.par.xml 311B
.project 479B
Sample-Service
bin
META-INF
MANIFEST.MF 177B
spring
module-context.xml 875B
osgi-context.xml 582B
com
sample
service
IService.class 231B
impl
ServiceImpl.class 1KB
.settings
org.eclipse.wst.common.project.facet.core.xml 184B
org.eclipse.jdt.core.prefs 598B
src
META-INF
MANIFEST.MF 177B
spring
module-context.xml 875B
osgi-context.xml 582B
com
sample
service
IService.java 148B
impl
ServiceImpl.java 531B
.project 662B
.classpath 400B
Sample-Web
bin
pom.xml 1KB
target
test-classes
m2e-wtp
web-resources
META-INF
maven
Sample-Web
Sample-Web
pom.xml 1KB
pom.properties 220B
MANIFEST.MF 111B
WebContent
META-INF
MANIFEST.MF 630B
WEB-INF
web.xml 1KB
classes
com
sample
web
SampleServlet.class 2KB
lib
applicationContext.xml 577B
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.xml 357B
org.eclipse.wst.common.component 474B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.validation.prefs 50B
.jsdtscope 503B
org.eclipse.jdt.core.prefs 664B
src
com
sample
web
SampleServlet.java 1KB
.project 1KB
.classpath 949B
共 37 条
- 1
资源评论
- 紫苏水釉2014-01-14值得下载,能学习到部分
bingo55269778
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功