gebbakcher
78
2018-12-10 13:32:55
3
1785

java.lang.NullPointerException 에러 해결방법좀 알려주세요..



<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.project.board.dao.*" %>
<%
	BoardBean board = (BoardBean)request.getAttribute("board");
%>

<!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 REPLY</title>
		<style type="text/css"><!-- Simple Css -->
			html, body{ margin:0; padding:0}
			body{ width:1000px; margin:0 auto; }
		</style>
		<script type="text/javascript">
			function replyboard(){
				boardform.submit();
			}
		</script>
	</head>
	
	<body>
		<form action="./BoardReplyView.do" method="post" name="boardform">
			<input type="hidden" name="num" value="<%=board.getNum() %>">
			<input type="hidden" name="re_ref" value="<%=board.getRe_ref() %>">
			<input type="hidden" name="re_lev" value="<%=board.getRe_lev() %>">
			<input type="hidden" name="re_seq" value="<%=board.getRe_seq() %>">
			
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
				<tr><!-- BOARD TITLE -->
					<td colspan="2" align="center"><h2>JSP_BOARD REPLY</h2></td>
				</tr>
				
				<tr height="40">
					<th>WRITER</th>
					<td><input name="regi_name" type="text"/></td>
				</tr>
				
				<tr height="40">
					<th>PASSWORD</th>
					<td><input name="regi_pass" type="password"></td>
				</tr>
				
				<tr height="40">
					<th>SUBJECT</th>
					<td><input name="subject" type="text" size="50" maxlength="100" value="Re: <%=board.getSubject() %>"/></td>
				</tr>
				
				<tr>
					<th>CONTENT</th>
					<td><textarea name="content" style="width:100%; height:200px;"></textarea></td>
				</tr>
				
				<tr>
					<td colspan="2" align="right">
						<a href="javascript:replyboard()">[ADD]</a>&nbsp;&nbsp;
						<a href="javascript:history.go(-1)">[BACK]</a>
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>

Type Exception Report

Message An exception occurred processing [board/boardReply.jsp] at line [25]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception
org.apache.jasper.JasperException: An exception occurred processing [board/boardReply.jsp] at line [25]

22: 	
23: 	<body>
24: 		<form action="./BoardReplyView.do" method="post" name="boardform">
25: 			<input type="hidden" name="num" value="<%=board.getNum() %>">
26: 			<input type="hidden" name="re_ref" value="<%=board.getRe_ref() %>">
27: 			<input type="hidden" name="re_lev" value="<%=board.getRe_lev() %>">
28: 			<input type="hidden" name="re_seq" value="<%=board.getRe_seq() %>">


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.boardReply_jsp._jspService(boardReply_jsp.java:144)
	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)


Note The full stack trace of the root cause is available in the server logs.
jsp 파일하고 에러코드들 입니다.. nullpointexception 에러를 구글에 쳐보니 예외처리를 하라고 하는데 예외처리를 어떻게 하는지 모르겠습니다..
코딩초보라 자세히 알려주시면 정말 감사하겠습니다!!!!
0
0
  • 답변 3

  • odyssey320
    789
    2018-12-10 14:09:00

    board이놈이 null인가보네요.


    BoardBean board = (BoardBean)request.getAttribute("board");

    if(board == null) {

      board = new BoardBean();

    그런데 board라는 object가 null을 허용하시는건가요?

    1
  • 20170923
    1k
    2018-12-10 14:14:07 작성 2018-12-10 14:14:28 수정됨

    org.apache.jasper.JasperException: An exception occurred processing [board/boardReply.jsp] at line [25]


    22:

    23: <body>

    24: <form action="./BoardReplyView.do" method="post" name="boardform">

    25: <input type="hidden" name="num" value="<%=board.getNum() %>">

    26: <input type="hidden" name="re_ref" value="<%=board.getRe_ref() %>">

    27: <input type="hidden" name="re_lev" value="<%=board.getRe_lev() %>">

    28: <input type="hidden" name="re_seq" value="<%=board.getRe_seq() %>">


    board.getNum()이 null인거같은데

    board 안에 데이터는 제대로 있는지 확인해주세요

    1
  • gebbakcher
    78
    2018-12-10 16:59:14

    감사합니다!

    0
  • 로그인을 하시면 답변을 등록할 수 있습니다.