44일차
2012/09/26 - [기타] - [유용한 유틸] visual SVN server - 이클립스에서 공동 프로젝트 사용하기
부서목록 띄우기 DeptController
소스보기 접기
package kr.co.khi.controller;
import java.util.*;
import kr.co.khi.dao.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping ( "/dept/list" )
public class DeptController {
@Autowired
private DeptDao dao ;
@RequestMapping ( method = RequestMethod . GET )
public String list ( Map map) {
List list = dao . getList ();
map. put ( "list" , list) ;
return "dept/list" ;
}
}
접기
DeptDao
소스보기 접기
package kr.co.khi.dao;
import java.util.*;
import org.apache.ibatis.session.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.*;
@Repository
public class DeptDao {
@Autowired
private SqlSession mapper ;
public List getList () {
return mapper .selectList ( "dept.getList" );
}
}
접기
DeptDao
소스보기 접기
package kr.co.khi.dto;
public class DeptDto {
private String deptno ;
private String dname ;
private String loc ;
public DeptDto () {
}
public DeptDto ( String deptno, String dname, String loc) {
super ();
this . deptno = deptno;
this . dname = dname;
this . loc = loc;
}
public String getDeptno () {
return deptno ;
}
public void setDeptno ( String deptno) {
this . deptno = deptno;
}
public String getDname () {
return dname ;
}
public void setDname ( String dname) {
this . dname = dname;
}
public String getLoc () {
return loc ;
}
public void setLoc ( String loc) {
this . loc = loc;
}
}
접기
dept.xml
소스보기 접기
<? 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 = "dept" > <!-- namespace 는 중복 안됨 -->
< select id = "getList" resultType = "kr.co.khi.dto.DeptDto" >
select * from dept
</ select >
</ mapper >
접기
list.jsp
소스보기 접기
<? xml version = "1.0" encoding = "UTF-8" ?>
<%@ page language = "java" contentType = "text/html; charset=UTF-8"
pageEncoding = "UTF-8" %>
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<%
String cp = request.getContextPath();
%>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" />
< title > dept 목록 </ title >
</ head >
< body >
< div class = "mainouter" align = "center" >
< h1 > dept 목록 </ h1 >
< table class = "myBoard" width = "640" border = "3" >
< tr style =" background-color : #fcc " >
< th width = "20%" > deptno </ th >
< th width = "40%" > dname </ th >
< th width = "40%" > loc </ th >
</ tr >
< c:forEach var = "item" items = " ${list } " >
< tr >
< td > ${item.deptno } </ td >
<%-- <td style="text-align: left; padding-left: 20px;"><a href ="<%= cp %>/ bd /read?no=${item.no}"> ${item.title } (<span style="color: red;">${item.replycount}</span>)</a></td> --%>
< td > ${item.dname } </ td >
< td > ${item.loc } </ td >
</ tr >
</ c:forEach >
</ body >
</ html >
접기
만들어볼것~!
AbstractWizardFormController 는 그대로 가는게 더 낫다~! (예.회원가입) 나머지는 annotation이용하는게 낫다~
Homecontroller 삭제 home.jsp 삭제
svn 서버
시나리오 1 1. A가 소스를 고쳐서 올리고 2. B가 소스를 update해서 받는다.
시나리오 2 1. A와 B가 동일한 소스의 다른 부분을 고친다. 2. A가 commit을 하고 3. B가 commit을 시도한다.(오류발생) 4. B가 update 한다. (Merged : 1 - 병합이 된다.) 5. B가 commit을 한다.
시나리오 3 1. A와 B가 동일한 소스의 같은 부분을 고친다. 2. A가 commit을 하고 3. B가 commit을 시도한다.(오류발생) 4. B가 update 한다. (conflict : 1 - 충돌발생) 5. mine, 이전버전, 최근버전 소스 나옴 6. 둘다 나오게 하고 커밋할때 team 메뉴에 mark resolved 선택 (1). 버무린버전 (2). 내꺼 버전 (3). 상대편 버전 (4). 원본 버전 7. B가 commit