研修53日目


掲示板の変更、削除


変更→詳細表示+登録

実習をしながら
TestController
package com.spring.sample.web.test.controller;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.spring.sample.web.test.service.ITestService;

@Controller
public class TestController {

	//객체주입 받겠다.
	@Autowired
	public ITestService iTestService;
	
	@RequestMapping(value="/test1")
	
	public ModelAndView test1(ModelAndView mav) throws Throwable {
		
		List<HashMap<String, String>>list
					= iTestService.getBList();
		
		mav.addObject("list", list);
		
		mav.setViewName("test/test1");
	
		return mav;
		
	}
	
	//등록
	@RequestMapping(value="/test2")
	public ModelAndView tes2(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav) throws Throwable{
		if(params.get("bNo") !=null) {
			//단일 컬럼은 해쉬맵으로 갖고온다
			HashMap<String, String> data
			=iTestService.getB(params);
			
			mav.addObject("data", data);
			
			mav.setViewName("test/test2");
			
		} else {
		//redirect: 주소 => 해당주소로 이동.
   	       // 즉, 컨트롤러에서 컨트롤러로 이동
		//get방식만 적용됨
			mav.setViewName("redirect:test1");
		}
		
		return mav;
	}

	@RequestMapping(value="/ajaxTest")
	public  ModelAndView ajaxtest(ModelAndView mav) {
		
		mav.setViewName("test/ajaxTest");
		return mav;
	}
	//상세보기
	@RequestMapping(value="/test3")
	public ModelAndView test3(ModelAndView mav) {
		mav.setViewName("test/test3");
		
		return mav;
	}
	
	@RequestMapping(value="/test3s")
	public ModelAndView test3s(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav) {
	
			
			try {
				int cnt = iTestService.addB(params);
				
				if(cnt > 0 ) {
					 mav.setViewName("redirect:test1");
				} else {
					 mav.addObject("msg", "등록실패");
					 mav.setViewName("test/test3s");
				}
				
			} catch (Throwable e) {
				e.printStackTrace();
				 mav.addObject("msg", "오류발생");
				 mav.setViewName("test/test3s");
			}
			
		
		return mav;
	}
	//수정
	@RequestMapping(value="/test4")
	public ModelAndView test4(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav) throws Throwable{
		if(params.get("bNo") !=null) {
			//단일 컬럼은 해쉬맵으로 갖고온다
			HashMap<String, String> data=iTestService.getB(params);
			
			mav.addObject("data", data);
			
			mav.setViewName("test/test4");
			
		} else {
			//redirect: 주소 => 해당주소로 이동. 
            		//즉, 컨트롤러에서 컨트롤러로 이동
			//get방식만 적용됨
			mav.setViewName("redirect:test1");
		}
		
		return mav;
	}
	
	@RequestMapping(value="/test4s")
	public ModelAndView test4s(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav) {
	
			
			try {
				int cnt = iTestService.updateB(params);
				
				mav.addObject("cnt", cnt);
					
			} catch (Throwable e) {
				e.printStackTrace();
				mav.addObject("msg", "오류발생");
			}
			
			mav.setViewName("test/test4s");
		
		return mav;
	}
	
	@RequestMapping(value="/test5s")
	public ModelAndView test5s(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav) {
	
			
			try {
				int cnt = iTestService.deleteB(params);
				
				if(cnt > 0 ) {
					 mav.setViewName("redirect:test1");
				} else {
					 mav.addObject("msg", "등록실패");
					 mav.setViewName("test/test5s");
				}
				
			} catch (Throwable e) {
				e.printStackTrace();
				 mav.addObject("msg", "오류발생");
				 mav.setViewName("test/test5s");
			}
			
		
		return mav;
	}
}
ITestService
package com.spring.sample.web.test.service;

import java.util.HashMap;
import java.util.List;

public interface ITestService {

	public List<HashMap<String, String>> getBList() throws Throwable;

	public HashMap<String, String> getB(HashMap<String, String> params) throws Throwable;

	public int addB(HashMap<String, String> params) throws Throwable;

	public int updateB(HashMap<String, String> params) throws Throwable;

	public int deleteB(HashMap<String, String> params) throws Throwable;
}
TestService
package com.spring.sample.web.test.service;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.spring.sample.web.test.dao.ITestDao;

@Service
public class TestService implements ITestService {

	//객체 주입 받겠다.
	@Autowired
	public ITestDao iTestDao;
	
	@Override
	public List<HashMap<String, String>> getBList() throws Throwable {
		
		return iTestDao.getBList();
	}

	@Override
	public HashMap<String, String> getB(HashMap<String, String> params) throws Throwable {
		
		return iTestDao.getB(params);
	}

	@Override
	public int addB(HashMap<String, String> params) throws Throwable {
		
		return iTestDao.addB(params);
	}

	@Override
	public int updateB(HashMap<String, String> params) throws Throwable {
		// TODO Auto-generated method stub
		return iTestDao.updateB(params);
	}

	@Override
	public int deleteB(HashMap<String, String> params) throws Throwable {
		return iTestDao.deleteB(params);
	}

}
ITestDao
package com.spring.sample.web.test.dao;

import java.util.HashMap;
import java.util.List;

public interface ITestDao {
	
	public List<HashMap<String, String>> getBList() throws Throwable;

	public HashMap<String, String> getB(HashMap<String, String> params) throws Throwable;

	public int addB(HashMap<String, String> params) throws Throwable;

	public int updateB(HashMap<String, String> params) throws Throwable;

	public int deleteB(HashMap<String, String> params) throws Throwable;
}
TestDao
package com.spring.sample.web.test.dao;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

//저장소에 접근한다.
@Repository
public class TestDao implements ITestDao {

	@Autowired
	public SqlSession sqlSession;

	@Override
	public List<HashMap<String, String>> getBList() throws Throwable {
		
		return sqlSession.selectList("B.getBList");
	}

	@Override
	public HashMap<String, String> getB(HashMap<String, String> params) throws Throwable {
		//단일row selectOne
		return sqlSession.selectOne("B.getB",params);
	}

	@Override
	public int addB(HashMap<String, String> params) throws Throwable {
		
		return sqlSession.insert("B.addB",params);
	}

	@Override
	public int updateB(HashMap<String, String> params) throws Throwable {
		// TODO Auto-generated method stub
		return sqlSession.update("B.updateB", params);
	}

	@Override
	public int deleteB(HashMap<String, String> params) throws Throwable {
		return sqlSession.delete("B.deleteB", params);
	}
	
}
B_SQL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="B"><!-- namespace: 클래스명과동일 -->
	<!-- id: 메소드명과 동일 -->
	<!-- resultType: row 1줄의 형태를 지정 -->
	<!-- 쿼리 작성 시 ; 이 들어가면 실행 되지 않음 -->
	<select id="getBList" resultType="hashmap">
	SELECT B_NO, B_TITLE, B_WRITER, TO_CHAR(B_DT, 'YYYY-MM-DD')AS B_DT
	FROM B
	ORDER BY B_NO DESC
	</select>
	<!-- parameterType은 받는 값타입에 대한 것 resultType: 쿼리결과타입에 대한 것 -->
	<select id="getB" parameterType="hashmap" resultType="hashmap">
	SELECT B_NO, B_TITLE, B_WRITER, B_CON, TO_CHAR(B_DT, 'YYYY--MM--DD') AS B_DT
	FROM B
	WHERE B_NO = #{bNo}
	</select>
	<!-- 값만 넣어주면 되기 때문에 resultType이 필요없음  -->
	<insert id="addB" parameterType="hashmap">
		INSERT INTO B(B_NO, B_TITLE,B_WRITER, B_CON)
		VALUES(B_SEQ.NEXTVAL, #{bTitle}, #{bWriter}, #{bCon})
	</insert>
	
	<update id="updateB" parameterType="hashmap">
		UPDATE B SET B_TITLE= #{bTitle}, B_CON = #{bCon}
		WHERE B_NO = #{bNo}
	</update>
	
	<delete id="deleteB" parameterType="hashmap">
		DELETE FROM B
		WHERE B_NO = #{bNo}
	</delete>
</mapper>
test 2(詳細表示ページ)
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%> 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>상세보기</title>
<script type="text/javascript"
		src="resources/script/jquery/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#listBtn").on("click", function(){
		location.href="test1";
	});
	
	$("#updateBtn").on("click",function(){
		$("#goForm").attr("action", "test4");
		$("#goForm").submit();
	}); //up Btn end
	
	$("#deleteBtn").on("click", function(){
		if(confirm("삭제하시겠습니까?")){
			$("#goForm").attr("action", "test5s");
			$("#goForm").submit();
		}		
	}); //deleteBtn
}); //ready end
</script>
</head>
<body>
<form action="#" id="goForm" method="post">
	<input type="hidden" name="bNo" value="${data.B_NO}"/>
</form>
번호: ${data.B_NO}<br/>
제목: ${data.B_TITLE}<br/>
작성자: ${data.B_WRITER}<br/>
작성일: ${data.B_DT}<br/>
내용<br/>
${data.B_CON}<br/>
<input type="button" value="수정" id="updateBtn"/>
<input type="button" value="삭제" id="deleteBtn"/>
<input type="button" value="목록으로" id="listBtn"/>
</body>
</html>
test 4(ページの変更)
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%> 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript"
		src="resources/script/jquery/jquery-1.12.4.min.js"></script>
<script type="text/javascript"
		src="resources/script/ckeditor/ckeditor.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
	CKEDITOR.replace("bCon", {
		resize_enabled : false,
		languague : "ko",
		enterMode : "2",
		width : "600",
		height: "300"
	});
	
	$("#backBtn").on("click", function(){
		history.back();
	});
	//form에서 작성하다 엔터누를 시 실행 방지 
	$("#updateForm").on("keypress", "input", function(event){
		if(event.keyCode ==13 ){
			return false;
		}
	});
	
	$("#updateBtn").on("click",function(){
		$("#bCon").val(CKEDITOR.instances['bCon'].getData());
		//입력된게 없는 경우
		if($.trim($("#bTitle").val()) == ""){
			alert("제목을 입력해주세요");
			$("#bTitle").focus();
		} else if($.trim($("#bCon").val()) == ""){
			alert("내용을 입력해 주세요");
			$("#bCon").focus();
		} else{
			$("#updateForm").submit();
		}
	}); //addBtn end
}); //ready end
</script>
</head>
<body>
<form action="test4s" id="updateForm" method="post">
<input type="hidden" name="bNo" value="${data.B_NO}"/>
제목<input type="text" id="bTitle" name="bTitle" value="${data.B_TITLE}"/><br/>
작성자: ${data.B_WRITER}<br/>
내용<br/>
<textarea rows="20" cols="50" id="bCon" name="bCon">${data.B_CON}</textarea><br/>
</form>
<input type="button" value="수정" id="updateBtn"/>
<input type="button" value="뒤로가기" id="backBtn"/>
</body>
</html>
test 4 s(最終チェックページ)
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>오류발생 메시지</title>
<script type="text/javascript"
		src="resources/script/jquery/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	//el 태그 자바스크립트에서 사용 시 무조건 따옴표로 묶어준다.
	if("${cnt}" > 0) {
		$("#goForm").submit();
	} else if("${cnt}" == 0) {
		alert("문제발생");
		history.back();
	} else{
		alert("${msg}");
		history.back();
	}
});
</script>
</head>
<body>
<form action="test2" id="goForm" method="post"> 
	<input type="hidden" name="bNo" value="${param.bNo}" />
</form>
</body>
</html>
test 5 s(削除)
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
// el tag를 script에서 사용 시 ""로  묵어야 함
// alert(오류발생);  <- 따옴표 없을 시 오류난다
// alert("오류발생");  <- 따옴표 있을 시
alert("${msg}");
history.back();
</script>
</head>
<body>

</body>
</html>
結果



実習コード
TestMController
package com.spring.sample.web.test.controller;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.spring.sample.web.test.service.ITestMService;

@Controller
public class TestMController {

	@Autowired
	public ITestMService iTestMService;
	
	@RequestMapping(value="/testMList")
	public ModelAndView testMService(ModelAndView mav) throws Throwable{
		
	List<HashMap<String, String>>list
				= iTestMService.getMList();
	
	mav.addObject("list1", list);
	
	mav.setViewName("test/testMList");
		
		return mav;
	}
	
	@RequestMapping(value="/testMDetail")
	public ModelAndView testm2(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav) throws Throwable{
		if(params.get("mNo") != null) {
			HashMap<String, String> data
						= iTestMService.getM(params);
			
		mav.addObject("data", data);
		
		mav.setViewName("test/testMDetail");
		} else {
			mav.setViewName("redirect:testMList");
		}
		return mav;
		
	}
	
	@RequestMapping(value="/testMAdd")
	public ModelAndView testMAdd(ModelAndView mav) {
		mav.setViewName("test/testMAdd");
		
		return mav;
	}
	
	@RequestMapping(value="/testMAdds")
	public ModelAndView testMAdds(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav){
				
	
		try {
			int cnt = iTestMService.addM(params);
			
			if(cnt > 0) {
				mav.setViewName("redirect: testMList");
			} else {
				mav.addObject("msg", "문제발생");
				mav.setViewName("redirect: testMAdds");
			}
		} catch (Throwable e) {
			e.printStackTrace();
			mav.addObject("msg", "오류발생");
			mav.setViewName("test/testMAdds");
			
			
		}
		
		
		return mav;
		 
	}
	@RequestMapping(value="/testMUpdate")
	public ModelAndView testMUpdate(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav) throws Throwable{
		if(params.get("mNo") != null) {
			HashMap<String, String> data
						= iTestMService.getM(params);
			
		mav.addObject("data", data);
		
		mav.setViewName("test/testMUpdate");
		} else {
			mav.setViewName("redirect:testMList");
		}
		return mav;
		
	}
	
	@RequestMapping(value="/testMUpdates")
	public ModelAndView testMUpdates(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav){
				
	
		try {
			int cnt = iTestMService.updateM(params);
			
			mav.addObject("cnt", cnt);
				
			
		} catch (Throwable e) {
			e.printStackTrace();
			mav.addObject("msg", "오류발생");
			
		}
		mav.setViewName("test/testMUpdates");
		
		
		return mav;
	}
	
	
	@RequestMapping(value="/testMDeletes")
	public ModelAndView testMdeltes(
			@RequestParam HashMap<String, String> params,
			ModelAndView mav){
				
	
		try {
			int cnt = iTestMService.deleteM(params);
			
			if(cnt > 0) {
				mav.setViewName("redirect: testMList");
			} else {
				mav.addObject("msg", "문제발생");
				mav.setViewName("redirect: testMDeletes");
			}
		} catch (Throwable e) {
			e.printStackTrace();
			mav.addObject("msg", "오류발생");
			mav.setViewName("test/testMDeletes");
			
			
		}
		
		return mav;
		 
	}
}//class end
ITestMService
package com.spring.sample.web.test.service;

import java.util.HashMap;
import java.util.List;

public interface ITestMService {

	public List<HashMap<String, String>> getMList() throws Throwable;

	public HashMap<String, String> getM(HashMap<String, String> params) throws Throwable;

	public int addM(HashMap<String, String> params) throws Throwable;

	public int updateM(HashMap<String, String> params) throws Throwable;

	public int deleteM(HashMap<String, String> params) throws Throwable;

}
TestMService
package com.spring.sample.web.test.service;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.spring.sample.web.test.dao.ITestMDao;

@Service
public class TestMService implements ITestMService {
	
	@Autowired
	public ITestMDao iTestMDao;
	
	@Override
	public List<HashMap<String, String>> getMList() throws Throwable {
		
		return iTestMDao.getMList();
	}

	@Override
	public HashMap<String, String> getM(HashMap<String, String> params) throws Throwable {
		
		return iTestMDao.getM(params);
	}

	@Override
	public int addM(HashMap<String, String> params) throws Throwable {
		return iTestMDao.addM(params);
	}

	@Override
	public int updateM(HashMap<String, String> params) throws Throwable {
		return iTestMDao.updateM(params);
	}

	@Override
	public int deleteM(HashMap<String, String> params) throws Throwable {
		return iTestMDao.deleteM(params);
	}

}
ITestMDao
package com.spring.sample.web.test.dao;

import java.util.HashMap;
import java.util.List;

public interface ITestMDao {

	public List<HashMap<String, String>> getMList() throws Throwable;

	public HashMap<String, String> getM(HashMap<String, String> params) throws Throwable;

	public int addM(HashMap<String, String> params) throws Throwable;

	public int updateM(HashMap<String, String> params) throws Throwable;

	public int deleteM(HashMap<String, String> params)  throws Throwable;

}
TestMDao
package com.spring.sample.web.test.dao;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class TestMDao implements ITestMDao {

	@Autowired
	public SqlSession sqlSession;
	
	@Override
	public List<HashMap<String, String>> getMList() throws Throwable {
		
		return sqlSession.selectList("M.getMList");
	}

	@Override
	public HashMap<String, String> getM(HashMap<String, String> params) throws Throwable {
		
		return sqlSession.selectOne("M.getM", params);
	}

	@Override
	public int addM(HashMap<String, String> params) throws Throwable {
		
		return sqlSession.insert("M.addM", params);
	}

	@Override
	public int updateM(HashMap<String, String> params) throws Throwable {
		return sqlSession.update("M.updateM", params);
	}

	@Override
	public int deleteM(HashMap<String, String> params) throws Throwable {
		return sqlSession.delete("M.deleteM", params);
	}

}
M_SQL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="M"><!-- namespace: 클래스명과동일 -->
	<!-- id: 메소드명과 동일 -->
	<!-- resultType: row 1줄의 형태를 지정 -->
	<!-- 쿼리 작성 시 ; 이 들어가면 실행 되지 않음 -->
	<select id="getMList" resultType="hashmap">
	SELECT M_NO,M_ID,M_PW,M_NM,M_BIRTH,M_JOINDT
	FROM M
	ORDER BY M_NM ASC
	</select>
	
	<select id="getM" parameterType="hashmap" resultType="hashmap">
	SELECT M_NO,M_ID,M_PW,M_NM,M_BIRTH,M_JOINDT
	FROM M
	WHERE M_NO = #{mNo}
	</select>
	<select id="addM" parameterType="hashmap">
	INSERT INTO M(M_NO, M_ID,M_PW, M_NM, M_BIRTH,M_JOINDT)
	VALUES(M_SEQ.NEXTVAL, #{mId}, #{mPw},#{mNm}, #{mBr}, SYSDATE)
	</select>
	
	<update id="updateM" parameterType="hashmap">
	UPDATE M SET M_PW = #{mPw}, M_NM = #{mNm}
	WHERE M_NO = #{mNo}
	</update>
	
	<delete id="deleteM" parameterType="hashmap">
	DELETE FROM M
	WHERE M_NO = #{mNo}
	</delete>
</mapper>
testmdetail(詳細表示ページ)
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript"
		src="resources/script/jquery/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#listBtn").on("click",function(){
		location.href="testMList";
	}); //listBtn end
	
	$("#updateBtn").on("click",function(){
		$("#goForm").attr("action", "testMUpdate" );
		$("#goForm").submit();
	}); //up Btn end
	
	$("#deleteBtn").on("click",function(){
		if(confirm("삭제하시겠습니까?")){
		$("#goForm").attr("action", "testMDeletes");
		$("#goForm").submit();
		}
	}); //del Btn end
}); //ready end
	

</script>
</head>
<body>
<form action="#" id="goForm" method="post">
	<input type="hidden" name="mNo" value="${data.M_NO}"/> 
</form>

번호:${data.M_NO}<br/>
아이디:${data.M_ID}<br/>
비밀번호:${data.M_PW}<br/>
이름:${data.M_NM}<br/>
생년월일:${data.M_BIRTH}<br/>
가입일:${data.M_JOINDT}<br/>
<input type="button" value="수정" id="updateBtn"/>
<input type="button" value="삭제" id="deleteBtn"/>
<input type="button" value="목록으로" id="listBtn"/>
</body>
</html>
testmupdate(変更ページ)
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%> 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript"
		src="resources/script/jquery/jquery-1.12.4.min.js"></script>
<script type="text/javascript"
		src="resources/script/ckeditor/ckeditor.js">
</script>
<script type="text/javascript">
$(document).ready(function(){

	$("#backBtn").on("click", function(){
		history.back();
	});
	//form에서 작성하다 엔터누를 시 실행 방지 
	$("#updateForm").on("keypress", "input", function(event){
		if(event.keyCode ==13 ){
			return false;
		}
	});
	
	$("#updateBtn").on("click",function(){
	
		//입력된게 없는 경우
		if($.trim($("#mPw").val()) == ""){
			alert("비밀번호를 입력해주세요");
			$("#mPw").focus();
		} else if($.trim($("#mPwRe").val()) != $.trim($("#mPw").val())){
			alert("비밀번호가 일치하지않습니다.");
			$("#mPw").val("");
			$("#mPwRe").val("");
			$("#mPw").focus();
		} else{
			$("#updateForm").submit();
		}
	}); //addBtn end
}); //ready end
</script>
</head>
<body>
<form action="testMUpdates" id="updateForm" method="post">
<input type="hidden" name="mNo" value="${data.M_NO}"/>
아이디: ${data.M_ID}<br/>
비밀번호<input type="password" id="mPw" name="mPw" value="${data.M_PW}"/><br/>
비밀번호확인<input type="password" id="mPwRe" name="mPwRe" value="${data.M_PW}"/><br/>
이름<input type="text" id="mNm" name="mNm" value="${data.M_NM}"/><br/>
생년월일: ${data.M_BIRTH}<br/>
가입일: ${data.M_JOINDT}<br/>
내용<br/>
</form>
<input type="button" value="수정" id="updateBtn"/>
<input type="button" value="뒤로가기" id="backBtn"/>
</body>
</html>
testmupdates(修復チェックページ)
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>수정점검 및 오류발생 메시지</title>
<script type="text/javascript"
		src="resources/script/jquery/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	//el 태그 자바스크립트에서 사용 시 무조건 따옴표로 묶어준다.
	if("${cnt}" > 0) {
		$("#goForm").submit();
	} else if("${cnt}" == 0) {
		alert("문제발생");
		history.back();
	} else{
		alert("${msg}");
		history.back();
	}
});
</script>
</head>
<body>
<form action="testMDetail" id="goForm" method="post"> 
	<input type="hidden" name="mNo" value="${param.mNo}" />
</form>
</body>
</html>
testmdeletes(削除)
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
alert("${msg}");
history.back();
</script>
</head>
<body>

</body>
</html>
出力結果





掲示板の修正を削除してよかったので、少し感じましたが、幸いでした.
今日の授業が終わったら、自分で復習して、進捗状況を把握してみます.週末は全面的に復習しなければならない.