JSP 12일차

12. 모델2의 개요및 모델2의 설계과정->모델2의 게시판의 글목록보기구현



모델1,모델2 =>스프링

모델2(ModelViewController) —> DAO,Service(=>액션클래스)
○ 구조
JspBoard2
       |
       -src
       |
       -WebContent
                  |
                  -WEB-INF->web.xml (1)
         CommandPro.properties(2)
                                     #command=package.ActionClasss
          /list.do=action.ListAction
                          |
                          -dbset->dbmysql.conf(~.properties)
                          -lib->jstl.jar, standard.jar복사(3)
~.jsp ~.php ~.asp ~.nhn ~.do ==>url-pattern

JspBoard —>JspBoard2.war로 불러오기

1. 요청을 jsp로 처리하지 않고 서블릿을 거쳐서 처리
http://localhost:8090/JspBoard2/list.jsp
                                                               list.do

web.xml에서 컨트롤러 지정하기

xml

2. 요청명령어에 해당하는 클래스를 등록 ->파일생성
CommandPro.properties파일
/list.do=action.ListService

commandpro

 

3. 모든 jsp파일에서 jstl액션태그를 사용하고 싶다면
jstl.jar, standard.jar를 복사

lib

 

4. 웹상에서 요청을 할때 처리해주는 메서드를 위한 공통의 인터페이스를 하나 생성
CommandAction.java

commandaction

 

5. 컨트롤러 클래스를 작성
ControllerAction.java

controlleraction controlleraction1

============모델2 설계끝================
6. DB정보를 따로 파일로 만들어서 불러온다.(mybatis나중에작업)
dbmysql.conf , dboracle.conf

dbmysqldboracle

 

7. DBConnectionMgr.java에서 수정

dbconnectionmgr

 

8. 글목록보기 부터 구현->ListAction.java

listaction

 

9.list.jsp작성->모델1(자바코드(메서드호출)–>액션클래스에서 처리)

list list1

 

(Integer)request.getAttribute(“count”)==>${count}

불러온경로=D:/webtest/web/sou/JspBoard2/WebContent/WEB-INF/CommandPro.properties
command=/list.do
className=action.ListAction
commandClass=class action.ListAction
commandInstance=action.ListAction@1a92a49
commandMap={/list.do=action.ListAction@1a92a49}
command=/*.do
className=action.ListAction
commandClass=class action.ListAction
commandInstance=action.ListAction@41cafd
commandMap={/list.do=action.ListAction@1a92a49, /*.do=action.ListAction@41cafd}
request.getRequestURI()=/JspBoard2/list.do
request.getContextPath()=/JspBoard2
command=/list.do
com=action.ListAction@1a92a49
requestPro()호출
pool=lmj.board.DBConnectionMgr@16ac220
현재 레코드수(count=)13
number=13
view=/list.jsp

list_result