연습/관리페이지만들기

Spring MVC 구축

TimeSave 2022. 1. 21. 21:23

 

기본 Spring MVC 프로젝트 생성

 

기존 연습프로젝트 소스 분석

1. web.xml

 

welcom file list

<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

</welcome-file-list>

 

encoding filter : EUC - KR 설정

<filter>

<filter-name>encodingFilter</filter-name>

<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>EUC-KR</param-value>

</init-param>

</filter>

 

filter mapping : *.do 연결

<filter-mapping>

<filter-name>encodingFilter</filter-name>

<url-pattern>*.do</url-pattern>

</filter-mapping>

 

 

context-config 연결 : contextConfigLocation

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>classpath:springConfig.xml</param-value>

</context-param>

 

 

listener 연결 : org.springframework.web.context.ContextLoaderListener

<listener>

<listener-class>

org.springframework.web.context.ContextLoaderListener

</listener-class>

</listener>

 

dispatcher servlet 설정

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

<init-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/config/presentation-layer.xml</param-value>

</init-param>

</servlet>

 

servlet mapping

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

 

 

dispatcher servlet ==> servlet-context.xml

spring context -> root-context.xml

--> context listner 등록 연결된 듯

 

root-context에 bean 등록하기

1. xmllns

xmlns:context="http://www.springframework.org/schema/context"

xmlns:aop="http://www.springframework.org/schema/aop"

xmlns:tx="http://www.springframework.org/schema/tx"

 

2.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-3.0.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

 

schema locationd은 쌍따옴표 하나 안에 다 넣어줘야 한다.

 

 

 

 

'연습 > 관리페이지만들기' 카테고리의 다른 글

관리페이지 만들기 1  (0) 2022.01.21