
1. 함수에 cidx값 변경해주기
@RequestMapping(value="/{cidx}/commentDeleteAction.aws", method=RequestMethod.GET)
public JSONObject commentDeleteAction(
CommentVo cv,
@PathVariable("cidx") int cidx, //이걸 통해서 그 bidx값을 꺼낼 수 있다.
HttpServletRequest request
) throws Exception{
JSONObject js = new JSONObject();
int midx = Integer.parseInt(request.getSession().getAttribute("midx").toString());
cv.setMidx(midx);
cv.setCidx(cidx);
cv.setCip(userIp.getUserIp(request));
int value = commentService.commentDelete(cv);
js.put("value", value);
return js;
}
2. 컨트롤러 메서드 생성
public int commentDelete(CommentVo cv);
3. 코멘트 매퍼에서도 똑같이 생성
@Override
public int commentDelete(CommentVo cv) {
int value = cm.commentDelete(cv);
return value;
}
4. impl에 메서드 구현 해주기
<update id="commentDelete" parameterType="cv">
update comment set delyn='Y',cip=#{cip} where cidx = #{cidx} and midx=#{midx}
</update>
5. 쿼리 구문 작성하기