帮我看看这个问题怎么解决

cslg 2007-09-30 03:34:18
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
...全文
100 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
happytreefriends 2007-09-30
  • 打赏
  • 举报
回复
顶2,3,4楼
chjiangsh 2007-09-30
  • 打赏
  • 举报
回复
session 的问题!
shadao 2007-09-30
  • 打赏
  • 举报
回复

<%@ 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();
joejoe1991 2007-09-30
  • 打赏
  • 举报
回复
if (username==null || username.equals(""))
{
response.sendRedirect("index.jsp");
}

先判断是不是null 再判断值是不是空
wrxdos 2007-09-30
  • 打赏
  • 举报
回复
if(username==null||username.equals("")) response.sendRedirect("index.jsp");
jk88811 2007-09-30
  • 打赏
  • 举报
回复
NullPointerException

最好解决了, 首先确定到底是哪个变量是null...

81,116

社区成员

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

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