<delete id="deleteContents" parameterType="int">
delete from board where seq = #{seq}
</delete>
int deleteContents(int seq);
public int deleteContents(int seq){
SqlSession sqlSession = getSqlSessionFactory().openSession();
int re = -1;
try{
re = sqlSession.getMapper(BoardMapper.class).deleteContents(seq);
if(re > 0){
sqlSession.commit();
}else{
sqlSession.rollback();
}
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return re;
}
<td><a href="delete.jsp?seq=<%= board.getSeq() %>">삭제하기</a></td>
<%
int seq = Integer.parseInt(request.getParameter("seq"));
BoardDao2 dao = BoardDao2.getInstance();
int re = dao.deleteContents(seq);
if(re > 0)
out.println("삭제 성공");
else
out.println("삭제 실패");
%>