sitelink1  
sitelink2  
extra_vars5  
extra_vars6  

Welcome Page

A web application, like any other web site, can specify a list of welcome pages. When you open a web application without specifying a particular page, a default "welcome page" is served as the response.

다른 웹사이트와 마찬가지로 웰컴 페이지의 리스트를 명시할 수 있다. 웹사이트를 열었을때 특정한 페이지를 지정하지 않는다면 기본적으로 "welcome page"가 서비스 된다.

web.xml

When a web application loads, the container reads and parses the "Web Application Deployment Descriptor", or "web.xml" file. The framework plugs into a web application via a servlet filter. Like any filter, the "struts2" filter is deployed via the "web.xml".

웹 어플리케이션이 로드될때 컨테이너는 "Web Application Deployment Descriptor" 또는 "web.xml" 파일을 읽고 파싱한다. 프레임워크는 servlet filter를 경유하여 웹 어플리케이션에 결합된다. "struts2" fitler는 "web.xml"에 경유하여 디플로이 된다.


web.xml - The Web Application Deployment Descriptor

·미리보기 | 소스복사·
  1. <?xml version="1.0" encoding="ISO-8859-1"?>  
  2. <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"   
  3.   "http://java.sun.com/dtd/web-app_2_3.dtd">  
  4. <web-app>  
  5.   
  6.   <display-name>Struts 2 MailReader</display-name>  
  7.   
  8.   <filter>  
  9.     <filter-name>struts2</filter-name>  
  10.     <filter-class>  
  11.       org.apache.struts2.dispatcher.FilterDispatcher   
  12.     </filter-class>  
  13.    </filter>  
  14.   
  15.   <filter-mapping>  
  16.     <filter-name>struts2</filter-name>  
  17.     <url-pattern>/*</url-pattern>  
  18.   </filter-mapping>  
  19.   
  20.   <listener>  
  21.     <listener-class>  
  22.       org.springframework.web.context.ContextLoaderListener   
  23.     </listener-class>  
  24.   </listener>  
  25.   
  26.   <!-- Application Listener for MailReader database -->  
  27.   <listener>  
  28.     <listener-class>  
  29.       mailreader2.ApplicationListener   
  30.     </listener-class>  
  31.   </listener>  
  32.   
  33.   <welcome-file-list>  
  34.     <welcome-file>index.html</welcome-file>  
  35.   </welcome-file-list>  
  36.   
  37. </web-app>  



 You might note that the web.xml configuration does not specify which file extension to use with actions. The default extension for Struts 2 is ".action", but the extension can be changed in the struts.properties file. For compatability with prior releases, the MailReader uses a .do extension for actions.

당신이 web.xml에 환경설정하는 것이 action 사용을 위한 화일 확장을 의미하지는 않는다.
struts2의 기본 확장은 ".action"이지만 확장이 struts.properties 화일내에서 변경될 수 있다.
이전 릴리즈와의 호환성을 위해 MailReader는 액션의 확장으로 .do를 사용한다.


struts.properties
struts.action.extension = do

The web.xml does specify a "Welcome File List" for the application. When a web address refers to a directory rather than an individual file, the container consults the Welcome File List for the name of a page to open by default.
However, most Struts applications do not refer to physical pages, but to "virtual resources" called actions. Actions specify code that we want to be run before a page or other resource renders the response. An accepted practice is to never link directly to server pages, but only to logical action mappings. By linking to actions, developers can often "rewire" an application without editing the server pages.

web.xml 화일에 어플리케이션에 대한 "Welcome File List"을 명시한다.
web address는 개별적인 file이라기보다는 directory로 연결된다. 컨테이너는 기본 open으로 page의 이름에 대한 Welcome File List를 참고한다.
그러나 대부분의 struts 어플리케이션은 물리적인 page에 연결되지 않고, "virtual resources" 라 불리는 액션에 연결된다.
Action은 이전 페이지 또는 응답에 대한 다른 resource를 실행하기를 원하는 코드를 명시한다.
실제로는 server page에 직접적으로 link하지 않고, 단지 logical action mapping을 하게 된다.
action의 link에 의해 개발자는 server page의 수정없이 어플리케이션의 "rewire"(비즈니스 로직의 변경)를 수행할 수 있다.


Best Practice:

"Link actions not pages."


번호 제목 글쓴이 날짜 조회 수
31 샘플예제 file 황제낙엽 2009.03.02 196
» A Walking Tour of the Struts 2 MailReader Application (2) 황제낙엽 2008.12.10 63
29 A Walking Tour of the Struts 2 MailReader Application (1) 황제낙엽 2008.12.10 205
28 스트러츠2 샘플 어플리케이션 (MailReader Demonstration Application) file 황제낙엽 2008.11.20 574
27 스트러츠2 실습 예제 모음 (Struts Showcase) 황제낙엽 2008.11.20 56362
26 Struts와 Struts2의 로그인 매커니즘 비교 황제낙엽 2008.10.23 82
25 Struts2 시작하기 황제낙엽 2008.09.22 49010
24 Struts2(스트럿츠2) Feature(특징) 황제낙엽 2008.07.12 92
23 책 Starting Struts 2 - Free Online Version (InfoQ.com) file 황제낙엽 2008.07.11 490
22 스트러츠2 활용 Upload 예제 file 황제낙엽 2007.08.14 115
21 Struts 프레임워크를 이용한 효율적인 개발 전략 황제낙엽 2007.01.30 75
20 MyEclipse를 사용한 Struts 빠른 시작 황제낙엽 2007.01.26 335
19 EJB+JSP를 활용한 J2EE기반의 샘플 프로젝트 (JPetStore-5.0) 황제낙엽 2007.01.18 134
18 EJB+JSP를 활용한 J2EE기반의 샘플 프로젝트 (JPetStore-4.0.5) file 황제낙엽 2005.10.28 58
17 Struts GUI XML 작성 Tool 들 황제낙엽 2006.02.24 215
16 스트러츠로 작성된 웹서점 샘플화일 (Struts+Hsql) 황제낙엽 2005.11.24 76
15 Validation과 Dispatcher액션 황제낙엽 2006.05.22 290
14 폼빈의 Reset 황제낙엽 2006.05.22 116
13 Struts-Config.xml 과 액션과 JSP의 관계 황제낙엽 2006.05.22 65
12 struts-config 설명 및 작성방법 황제낙엽 2006.02.27 73