帮我看看这个问题怎么解决
org.apache.jasper.JasperException: An exception occurred processing JSP page /display.jsp at line 3
1: <%@ page language="java" import="java.sql.*" contentType="text/html;charset=GB2312"%>
2: <%String username=(String) session.getAttribute("username");
3: if(username.equals("")) response.sendRedirect("index.jsp");
4: %>
5: <%
6: String path = request.getContextPath();
java.lang.NullPointerException------解决方案--------------------NullPointerException最好解决了, 首先确定到底是哪个变量是null...
------解决方案-------------------- if(username==null||username.equals("")) response.sendRedirect("index.jsp");
------解决方案--------------------if (username==null || username.equals(""))
{
response.sendRedirect("index.jsp");
}
先判断是不是null 再判断值是不是空
------解决方案--------------------HTML code
<%@ page language="java" import="java.sql.*" contentType="text/html;charset=GB2312"% >
<%String username=(String) session.getAttribute("username");
if(username==null || username.equals("")) response.sendRedirect("index.jsp");
% >
<%
String path = request.getContextPath();
------解决方案--------------------
session 的问题!
我的异常网推荐解决方案:An exception occurred processing JSP page,http://www.aiyiweb.com/j2se/33144.html