재밌고 어려운 IT를 이해해보자~!
NullPointerException 본문
memberDTO.setSearchCondition("정보출력");
memberDAO에 "정보출력" 이라는 searchCondition으로 찾는 selectOne이 없어서 생긴 에러
memberDTO.setSearchCondition("내정보출력");
알맞는 searchCondition으로 에러수정
else if (memberDTO.getSearchCondition().equals("내정보출력")) {
try {
pstmt = conn.prepareStatement(SELECTONE_MYINFO);
pstmt.setString(1, memberDTO.getId());
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
data = new MemberDTO();
data.setMemberNum(rs.getInt("MEMBERNUM"));
data.setId(rs.getString("ID"));
data.setMemberPW(rs.getString("PW"));
data.setName(rs.getString("NAME"));
data.setNickname(rs.getString("NICKNAME"));
data.setBirth(rs.getString("BIRTH_DATE"));
data.setPh(rs.getString("PH"));
data.setProfile(rs.getString("PROFILE"));
data.setGrade(rs.getString("GRADE"));
data.setBoardNum(rs.getInt("BOARDNUM"));
}
rs.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
JDBCUtil.disconnect(pstmt, conn);
}
}
'JAVA Error Solution' 카테고리의 다른 글
java.sql.SQLSyntaxErrorException (0) | 2024.01.28 |
---|---|
PropertyNotFoundException (0) | 2024.01.28 |
IllegalArgumentException (0) | 2024.01.26 |
비동기처리에러발생 (0) | 2024.01.26 |
SQLSyntaxErrorException (0) | 2024.01.18 |