@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String param = request.getParameter("param");//获取发送的参数
String content = request.getParameter("content");//获取发送的参数
ExecutorService threadPool = Executors.newFixedThreadPool(5);//定义长度为5的线程池
threadPool .execute(new Runnable(){
@Override
public void run() {
//在此处如何获取request对象
//如何获取param参数
//如何获取content参数
//逻辑代码,数据库操作
}
});
}
1 回答
慕虎7371278
TA贡献1802条经验 获得超4个赞
简单封装下即可,比例param参数
public class MyTask implements Runnable{
private String param;
public MyTask(String param){
this.param = param;
}
@Override
public void run() {
......
}
}
//在doGet()中
MyTask task = new MyTask(param);
threadPool .execute(task);
添加回答
举报
0/150
提交
取消