【问题标题】:in jsp response.sendRedirect() is not working在 jsp response.sendRedirect() 中不起作用
【发布时间】:2013-08-12 15:12:39
【问题描述】:

这是我的代码

HttpSession s=request.getSession(false);
if(s==null)
{
    System.out.println("123456");
    response.sendRedirect("home.jsp");
}
System.out.println(s);
s.setAttribute("vid",request.getParameter("v"));
System.out.println(request.getParameter("v"));
new action.VideoAction().vPlay(request);

123456 正在打印,但 response.sendRedirect() 不起作用并且 s.setAttribute() 出现错误。

【问题讨论】:

标签: jsp session


【解决方案1】:

在发送重定向后添加return

response.sendRedirect("home.jsp");
return;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-18
    • 2012-04-09
    • 2016-01-18
    • 1970-01-01
    • 2015-07-15
    • 1970-01-01
    • 2020-09-14
    相关资源
    最近更新 更多