'web.xml설정과 위치'에 해당되는 글 1건

  1. 2008.12.22 [Struts2] web.xml설정과 위치

[Struts2] web.xml설정과 위치

|

web.xml의 위치는 /WEB-INF/web.xml에 존재해야 한다.

 

web.xml 예제
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 <display-name>0723_Struts2</display-name>
 <session-config>
  <session-timeout>30</session-timeout>
 </session-config> 
 <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
  <welcome-file>default.jsp</welcome-file>
 </welcome-file-list>
 <filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  <init-param>
   <param-name>actionPackages</param-name>
   <param-value>test1</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern> <!-- 모든 URI는 struts2 filter 를 거친다 -->
 </filter-mapping>
</web-app>

 

  • 위의 볼드체로 처리한 것처럼 web.xml에 필터 디스패처를 등록한다.
  • org.apache.struts2.dispatcher.FilterDispatcher 클래스가 스트럿츠 2의 핵심 컨트롤러 역할을 수행한다. 

     


'JAVA/JSP > Struts2' 카테고리의 다른 글

[Struts2] StartingStruts2(pdf)  (0) 2008.12.22
[Struts2] 파일별 기본 역활과 개념  (0) 2008.12.22
[Struts2] struts.properties  (0) 2008.12.22
[Struts2] struts.xml 이란?  (0) 2008.12.22
[Struts2] Architecture  (0) 2008.12.22
And
prev | 1 | next