2

主.jsp

String name = session.getAttribute("name").toString();
if (name == "" || name == null) {

    response.sendRedirect("index.jsp");

}

当用户通过登录访问该页面时,主页面没有问题。但是当用户想尝试在没有登录的情况下访问页面时,我想将页面重定向到 index.jsp,但是

org.apache.jasper.JasperException: An exception occurred processing JSP page /main.jsp

如何重定向到 index.jsp

4

1 回答 1

1

改变

String name = session.getAttribute("name").toString();

String name = (String)session.getAttribute("name");
于 2012-06-21T01:12:54.197 回答