주간 베스트 월간 베스트 3개월 베스트 베스트 게시물
연길시 신화서점 조선말 도서

spring web.xml

hmily1129 | 2013.08.22 22:28:26 댓글: 0 조회: 1889 추천: 0
분류웹 프로그래밍 https://life.moyiza.kr/itstudy/2001790

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
  id="WebApp_ID"
  version="2.5">
   

 <!-- 반드시 로그설정이 먼저 이루어져야 한다. -->
 <display-name>springtest</display-name>

 <context-param>
  <param-name>log4jConfigLocation</param-name>
  <param-value>/WEB-INF/log4j.properties</param-value>
 </context-param>
 <listener>
  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
 </listener>

 

 

 

 <listener>
  <!-- ContextLoaderListener 클래스를 리스너로 등록하면 XmlWebApplicationContext 객체 생성 -->
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>

 <context-param>

  <!-- Context 로 사용할 설정파일의 위치를 선언한다.-->
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/config/applicationContext.xml,/WEB-INF/config/as-aspect.xml</param-value>
 </context-param>

 

 

 <!-- DispatcherServlet  그유명한 서블릿설정파일의 초기화.-->
 <servlet>
  <servlet-name>spring</servlet-name>

  <!--  위의 설정한 서블릿 명칭 그대로 WEB-INF/ 아래에  spring-servlet.xml 파일을 반드시 생성해야한다.-->
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <init-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>/WEB-INF/config/applicationContext.xml,/WEB-INF/config/as-aspect.xml</param-value>

   <!--  기타 모든 컨텍스트 설정파일들을 생성한뒤,  생성된 위치를 모두 등록한다. 다중파일 등록시 구분은 , 표시 또는 ; 또는  공백 -->
  </init-param>
  <load-on-startup>1</load-on-startup>
 </servlet>

 <!--

   만약 이주석을 풀면 Controller 에서 ModelAndView 를 아무리 리턴해도 해당 jsp 가 호출되지 않는다. ^^.

   *.jsp 마저도 디스패쳐가 ur을 훔쳐가기 때문에  돌고,도는 재귀현상으로인해 해당 url을 찾지 못하기 때문이다.

   *.jsp 마져도 또다시 컨트롤러의 RequestMapping 값과 비교해서 해당 url을 찾게되는데

   당연히 존재하지 않기때문에 페이지 not found 404 에러가 나게 된다. ^^
   <servlet-mapping>
     <servlet-name>spring</servlet-name>
     <url-pattern>*.jsp</url-pattern>
   </servlet-mapping>  
  -->


 <servlet-mapping>
  <servlet-name>spring</servlet-name>
  <url-pattern>*.do</url-pattern>
 </servlet-mapping>
 
 <servlet-mapping>
  <servlet-name>spring</servlet-name>
  <url-pattern>*.html</url-pattern>
 </servlet-mapping>

 

 

 

 <!--  =============== Filter  Character Encoding =============== -->
 <filter>
  <filter-name>Character Encoding</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>Character Encoding</filter-name>
  <url-pattern>/*</url-pattern>

 </filter-mapping>

 

 <welcome-file-list>
  <welcome-file>/WEB-INF/index.html</welcome-file>
  <welcome-file>/WEB-INF/index.htm</welcome-file>
  <welcome-file>/WEB-INF/index.jsp</welcome-file>
  <welcome-file>/WEB-INF/default.html</welcome-file>
  <welcome-file>/WEB-INF/default.htm</welcome-file>
  <welcome-file>/WEB-INF/default.jsp</welcome-file>
 </welcome-file-list>

 

 <!--  에러 페이지 설정은 AOP로 구현해도 되지만, 이렇게 선언해도 된다. ^^ -->

 <error-page>
  <error-code>404</error-code>
  <location>/WEB-INF/error/error.jsp</location>
 </error-page>
 

 

 <!--
  tag library 설정. <jsp-config> <taglib>
  <taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location>
  <taglib-uri>/spring</taglib-uri> </taglib> </jsp-config>
 -->
 <taglib>
  <taglib-uri>/spring</taglib-uri>
  <taglib-location>/WEB-INF/spring.tld</taglib-location>
 </taglib>
</web-app>

추천 (0) 선물 (0명)
IP: ♡.200.♡.147
3,006 개의 글이 있습니다.
제목 글쓴이 날짜 조회
관리자
2003-09-20
11720
관리자
2003-09-20
11264
관리자
2003-09-20
20325
지구인
2010-08-27
19188
지구인
2009-09-07
13477
SOLIDH
2010-01-29
15468
엔죠라이프
2004-10-07
16576
CHOSUN
2014-01-11
2441
CHOSUN
2014-01-07
2597
CHOSUN
2014-01-07
2383
CHOSUN
2014-01-07
2050
CHOSUN
2014-01-07
1793
CHOSUN
2014-01-07
1612
CHOSUN
2014-01-07
1178
즐거운개굴
2013-09-29
3002
hmily1129
2013-09-03
4910
hmily1129
2013-08-29
5371
hmily1129
2013-08-26
4793
hmily1129
2013-08-25
3637
hmily1129
2013-08-24
4165
hmily1129
2013-08-23
4323
hmily1129
2013-08-23
3597
hmily1129
2013-08-22
1889
hmily1129
2013-08-10
1625
hmily1129
2013-08-05
2154
hmily1129
2013-08-05
2093
hmily1129
2013-07-30
1471
CHOSUN
2013-07-23
1943
모이자 모바일