<%response.sendRedirect("member.do?command=loginForm");%>
<script src="script/member.js"></script>
// member.js
function loginCheck(){
if(document.frm.userid.value==""){
alert("아이디를 입력하세요")
document.frm.userid.focus()
return false;
}
if(document.frm.pwd.value==""){
alert("암호를 입력하세요")
document.frm.pwd.focus()
return false;
}
return true;
}
command에 전달된 값에 따라 어떤 작업을 할지가 결정이 되어 실행된다.
각command 별 실행할 작업들은 해당 실행코드가 들어있는 클래스 내부에,
그 중에서도 execute메서드 안에 있다.
Model2방식은 각 기능별로 클래스가 제작되어 실행되기를 기다리고, command값에 따라 선택되어 실행되는 형식
각 기능이 내장된 객체들의 인스턴스들이 상속(implements)받은 부모 인터페이스(Action)의 레퍼런스 변수에 저장하고,
레퍼런스 변수명.execute로 실행
각 클래스에 있는 execute 메서드는 Action 인터페이스에 존재하는 추상메서드를 오버라이딩한 메서드이다
각 클래스가 Action인터페이스를 상속(implement)하여, execute 메서드가 오버라이딩되면 Action 인터페이스의 레퍼런스 변수로 자식 클래스의 execute 메서드를 호출하여 사용한다.
command가 추가되면 클래스도 추가 생성하고, ActionFactory에 추가한다.
오늘 수업에서는 update까지 만들었다.
delete와 editAdmin은 내일
// Connection 객체 생성
con = Dbman.getConnection();
// 오토커밋 설정
try {con.setAutoCommit(true);}
catch (SQLException e1) {e1.printStackTrace();}
con.setAutoCommit(true) 작성하니까 이클립스에서 자동으로 try/catch하라고 해서 자동생성함
나중에 나를 위해서 태그 박고 정리함 ㅠ_ㅠ