[해결]jsp java 코드 좀 봐주실 수 있나요?
글쓴이: lalupo20 / 작성시간: 토, 2020/10/17 - 11:14오전
<% try { Connection con = DriverManager.getConnection(url, id, pw); Statement stat = con.createStatement(); String sql = "SELECT id, comment, userName, date FROM comments where postNum=" + idx; ResultSet rs = stat.executeQuery(sql); while (rs.next()) { int commentsId = rs.getInt(1); String comment = rs.getString(2); String userName = rs.getString(3); String commentTime = rs.getString(4); %> <table> <tr> <td width="0"> </td> <td align="left" width="100">이름</td> <td width="638" align="left">Comments</td> <td width="0">time</td> </tr> <tr> <td>commentTime</td> </tr> <tr height="1" bgcolor="#dddddd"><td colspan="4" width="407"></td></tr> <% } rs.close(); stat.close(); con.close(); }catch(Exception e) { } %>
위와 같은 코드인데
디버깅 해보면 ResultSet rs 이 라인에서 마지막 %> 부분으로 바로 점프합니다.
catch문 안쪾으로 들어가는 것도 아니고 그 밑으로 점프하는것은 무슨 경우인가요
제가 잘못 작성한 부분이 있나요?
Forums:
죄송합니다. 또 해결했습니다.
sql 구문에 컬럼명이 잘못되어 있었네요.
댓글 달기