ITeye博客

session 超时处理

master3003 · 2011-09-24 09:02 · Web前端 · Markdown

在servlet中是这样写的:

import javax.servlet.; import javax.servlet.http.; import java.io.; import java.util.;

public class sv1 extends HttpServlet { private static final String CONTENT_TYPE = "text/html; charset=GBK "; /*Initialize global variables/ public void init() throws ServletException { } /*Process the HTTP Post request/ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(CONTENT_TYPE); PrintWriter out = response.getWriter(); response.addHeader( "aaa ", "abcde " ); response.sendRedirect( "http://localhost:7001/cu.jsp " ); } /*Clean up resources/ public void destroy() { } } 在cu.jsp中显示请求头中没有我加入的aaa。

对我有用 丢个板砖 引用 举报 管理 TOP 回复次数:2

headstream

(大宝)

等 级:

#1楼 得分:0回复于:2002-04-22 15:13:52up一下

对我有用 丢个板砖 引用 举报 管理 TOP

dylanwolf

等 级:

#2楼 得分:0回复于:2002-04-22 15:35:45我觉得你调用 response.sendRedirect()后,客户端直接去连接 cu.jsp,并不会把你的 Header给加进去

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。