1. spring-mvc.xml 아래 코드로 수정 합니다.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- @Controller 어노테이션을 이용한 컨트롤러를 사용하기 위한 설정 -->
<mvc:annotation-driven />
<!-- DispatcherServlet의 매핑 경로를 "/"로 주었을때, JSP/HTML/CSS 등을 올바르게 처리 하기 위한
설정 -->
<mvc:default-servlet-handler />
<!-- prefix="/WEB-INF/view/"은 forward 시킬때 "board/list.jsp" 라고 입력을 하면 실제적으로는
"/WEB-INF/view/board/list.jsp" 가 된다. suffix=".jsp" 로 지정하면 "board/list" 만
입력을 하면 실제적으로는 "board/list.jsp" 가 된다. prefix는 앞에 내용을 붙이는 것이고 suffix는 뒤쪽에 내용을
붙이는 것이다. -->
<mvc:view-resolvers>
<mvc:jsp prefix="/WEB-INF/view/" suffix=".jsp" />
</mvc:view-resolvers>
<!-- 자동 DI 적용 -->
<context:annotation-config />

</beans>
2. src/main/resources 우클릭 -> new -> Folder 선택











3. resources 선택 -> 폴더명 : mybaits 으로 생성 합니다




4. src/main/resources/mybatis 폴더에

boardDao.xml 파일 생성 합니다.



5. src/main/java 우클릭 -> new -> Class 선택하여 생성 합니다.


Package 명 : com.spring.board.controller

Class명 : BoardController



6. BoardController.java 아래 코드 작성

package com.spring.board.controller;
import org.springframework.stereotype.Controller;
@Controller
public class BoardController {

}//class BoardController


7. board.xml 아래 코드 작성
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="com.spring.board.controller.BoardController" />
</beans>


Posted by 홍이홍이
,


1. web.xml에서 dispatcher 설정 및 Filter를 이용하여 한글처리를 합니다.

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring-mvc.xml
classpath:board.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>















2. src/main/resources에서 하위 폴더에 web.xml에서 설정한 

   spring-mvc.xml / board.xml 파일 생성 합니다.



3. board.xml에 아래 코드 작성 합니다.


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
</beans>

4. spring-mvc.xml에 아래 코드 작성 합니다.


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
</beans>



<끝>



Posted by 홍이홍이
,

안녕하세요 관리자 홍이홍이 입니다.

SQLD(SQL 개발자) 자격증 소개 및 시험일정 안내 드릴려고 합니다.




<끝>

'Certificate' 카테고리의 다른 글

2018 정보처리기사 시험일정  (0) 2018.01.20
Posted by 홍이홍이
,