gebbakcher
78
2018-11-30 13:25:50
4
3023

선생님들 http status 500 에러좀 봐주세여 jsp


자바 mvc 게시판 만들고 싶은데 오류가 떠서요..
org.apache.jasper.JasperException: An exception occurred processing [/board/boardList.jsp] at line [8]

5: 
6: <%
7: 	List list=(List)request.getAttribute("list");
8: 	int count=((Integer)request.getAttribute("count")).intValue();
9: 	int nowpage=((Integer)request.getAttribute("page")).intValue();
10: 	int maxpage=((Integer)request.getAttribute("maxpage")).intValue();
11: 	int startpage=((Integer)request.getAttribute("startpage")).intValue();


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:626)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:515)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause

java.lang.NullPointerException
	org.apache.jsp.board.boardList_jsp._jspService(boardList_jsp.java:129)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
이렇게 에러가뜹니다. 
jsp 코드입니다
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.project.board.dao.*" %>

<%
	List list=(List)request.getAttribute("list");
	int count=((Integer)request.getAttribute("count")).intValue();
	int nowpage=((Integer)request.getAttribute("page")).intValue();
	int maxpage=((Integer)request.getAttribute("maxpage")).intValue();
	int startpage=((Integer)request.getAttribute("startpage")).intValue();
	int endpage=((Integer)request.getAttribute("endpage")).intValue();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>JSP_BOARD</title>
		<style type="text/css"><!-- Simple Css -->
			html, body{ margin:0; padding:0}
			body{ width:1000px; margin:0 auto; }
		</style>
	</head>
	
	<body>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr><!-- BOARD TITLE -->
				<td colspan="5" align="center"><h2>JSP_BOARD LIST</h2></td>
			</tr>
			
			<tr><!-- BOARD COUNT -->
				<td colspan="5" align=right><h5>BOARD COUNT : <%=count %></h5></td>
			</tr>
			
			<tr><!-- BOARD LIST -->
				<th width="5%">NO</th>
				<th width="55%">SUBJECT</th>
				<th width="15%">REGI_NAME</th>
				<th width="15%">REGI_DATE</th>
				<th width="10%">READCOUNT</th>
			</tr>
			
			<%
			if(list.size() > 0){
				for(int i=0;i<list.size();i++){
					BoardBean board = (BoardBean)list.get(i); // LIST를 BoradBean 타입으로 변환
			%>
			<tr height="50">
				<td align="center"><%=board.getNum()%></td>
				<td>
					<%if(board.getRe_lev()!=0){ %>
						<%for(int a=0;a<=board.getRe_lev()*2;a++){ %>
						&nbsp;
						<%} %>
						▶
					<%}else{ %>
						▶
					<%} %>
					<a href="./BoardDetailAction.do?num=<%=board.getNum()%>">
						<%=board.getSubject()%>
					</a>
				</td>
				<td align="center"><%=board.getRegi_name() %></td>
				<td align="center"><%=board.getRegi_date() %></td>	
				<td align="center"><%=board.getReadcount() %></td>
			</tr>
			<%	
				}
			}else{	
			%>
			<tr height="100">
				<td colspan="5" align="center">NO DATA.</td>
			</tr>
			<%
			}
			%>
			<tr height="70"><!-- BOARD PAGING -->
				<td colspan="7" align="center">
					<%if(nowpage<=1){ %>
						[PREV]&nbsp;
					<%}else{ %>

					<a href="./BoardList.do?page=<%=nowpage-1 %>">[PREV]</a>&nbsp;
					<%} %>
					
					<%for(int a=startpage;a<=endpage;a++){
						if(a==nowpage){%>
						[<%=a %>]
						<%}else{ %>
						<a href="./BoardList.do?page=<%=a %>">[<%=a %>]</a>&nbsp;
						<%} %>
					<%} %>
					
					<%if(nowpage>=maxpage){ %>
					[NEXT]
					<%}else{ %>
					<a href="./BoardList.do?page=<%=nowpage+1 %>">[NEXT]</a>
				<%}%>
				</td>
			</tr>
			<tr align="right"><!-- BOARD BUTTONS -->
				<td colspan="5">
			   		<a href="./BoardWrite.do">[CREATE]</a>
				</td>
			</tr>
		</table>
	</body>
</html>

0
0
  • 답변 4

  • 구구구구
    1k
    2018-11-30 13:27:29

    count 가 null인것 같네요. 

    0
  • gebbakcher
    78
    2018-11-30 13:29:32
    어디를 어떻게 바꿔야 하는지 알려주시면 감사하겠습니다 ㅜㅜ
    0
  • load2000
    3k
    2018-11-30 13:53:16

    null 예외처리 하세요

    0
  • 리엥
    153
    2018-11-30 14:07:23
    java.lang.NullPointerException
    	org.apache.jsp.board.boardList_jsp._jspService(boardList_jsp.java:129)
    해당 위치에서 널포인트익셉션이 나오고 있으니, 해당위치를 보시고, 왜 null이 들어가지? 
    라고 분석하시고, 적절한 조치를 치하시면 되죠?(값이 반드시 들어가야한다면, 값이 반드시 들어가게)
    값이 안들어갈 수 있는 변수라면, 값이 안들어갈때, 에러 안나도록 처리.
    0
  • 로그인을 하시면 답변을 등록할 수 있습니다.