package com.truffle.everyair.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.truffle.everyair.db.NoticeBoardDao; import com.truffle.everyair.db.Noticeboard; @Service public class NoticeBoardServiceImpl implements NoticeBoardService { @Autowired private NoticeBoardDao ndDao; @Override public List<Noticeboard> NoticeBoardList(Noticeboard nb) { // TODO Auto-generated method stub return ndDao.NoticeBoardList(nb); } @Override public int Noticeboardtotal() { // TODO Auto-generated method stub return ndDao.Noticeboardtotal(); } @Override public Noticeboard detail(int nIdx) { // TODO Auto-generated method stub return ndDao.detail(nIdx); } @Override public int Noticeboardinsert(Noticeboard nb) { // TODO Auto-generated method stub return ndDao.Noticeboardinsert(nb); } @Override public int Noticeboardupdate(Noticeboard nb) { // TODO Auto-generated method stub return ndDao.Noticeboardupdate(nb); } @Override public int Noticeboarddelete(int nIdx) { // TODO Auto-generated method stub return ndDao.Noticeboarddelete(nIdx); } }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> <c:set var="conPath" value="<%=request.getContextPath() %>"/> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <form action="noticeModify.do" method="post"> <table> <caption>게시글 수정</caption> <tr><th>작성자</th> <td><input type="text" name="aID" size="30" value="${update.aID }"> </tr> <tr><th>제목</th> <td><input type="text" name="nTitle" size="30" required="required" value="${update.nTitle }"></td> </tr> <tr><th>본문</th> <td><textarea rows="5" cols="30" name="nContent">${update.nContent }</textarea></td> </tr> <tr><td colspan="2"> <input type="submit" value="수정"> <input type="reset" value="취소"> <input type="button" value="목록" onclick="location.href='nlist.do'"> </table> </form> </body> </html>
<update id="update" parameterType="NoticeBoard"> update noticeboard set nTitle=#{nTitle}, nContent=#{nContent} where nidx=#{nidx} </update>Controller has a problem, but I don't know how to modify the code.@RequestMapping(value="noticeModifyForm") public String noticeModifyForm() { return "noticeboard/noticeModifyForm"; } @RequestMapping(value="noticeModify") public String noticeModify(Noticeboard nb, String pageNum) { service.Noticeboardupdate(nb); return "forward:nlist.do?PageNum="+pageNum; }