两个servlet之间如何传递参数?

teva 2003-06-12 01:07:28
两个servlet之间如何传递参数?
...全文
1214 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
blackhost 2003-06-12
  • 打赏
  • 举报
回复
sesion
dooby 2003-06-12
  • 打赏
  • 举报
回复
或者再第一个servlet里面

this.getServletContext().setAttribute("111",你的参数)

再跳转servlert
再第二个servlet里面

this.getServletContext().getAttribute("111")

用完之后最好this.getServletContext().removeAttribute
dooby 2003-06-12
  • 打赏
  • 举报
回复
sorry 刚才写错了 楼上的方法是对的,我忘了用dispatcher了
希偌 2003-06-12
  • 打赏
  • 举报
回复
request.setAttribute(String name,Object obj);
request.getRequestDispatcher("/servlet/secondServlet").forword(request,response);
然后在secondServlet里用
request.getAttribute(String name);获取obj
dooby 2003-06-12
  • 打赏
  • 举报
回复
request.setAttribute("你的标识名","你的参数值")

在另一个servlet里面request.getAttribute

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧