program/struts2

struts2 - struts.xml

yoursyun 2008. 8. 20. 17:46

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
 
<struts>
 <constant name="struts.action.extension" value="visang" />
 <!--
 struts-default.xml 의 오버라이딩 위 내용은 확장자로 visang 을 사용 하겠다는 뜻이다.
 ex : helloWorld.action 대신 helloWorld.visang
 struts-default.xml 은 struts 설치 파일중 struts2-core-2.0.11.2.jar 압축을 해제 하면
 "\struts-2.0.11.2\lib\struts2-core-2.0.11.2" 위치에서 확인 할 수 있다.
 해당 파일을 확인 하면 여러가지 설정을 할 수 있도록 된 부분을 점검할 수 있다.
 //-->

<package name="tutorial" extends="struts-default" namespace="/tutorial">
 <!--
 name : 다른 페이지가 참조하기 위한 key
 extends : 상속 - 여기서는 struts-default.xml 을 상속 받는다.
 namespace : url과 package의 매핑을 제공한다.
 미 지정시 :
http://localhost:8080/helloProject/helloWorld.action
 지정시 : http://localhost:8080/helloProject/tutorial/helloWorld.action
 //-->

  <action name="HelloWorld" class="tutorial.HelloWorld">
  <!--
   name 은 url의 HelloWorld.action 이다.
   class 는 패키지명.클래스명 이다.
   //-->


  <result name="success">/helloWorld.jsp</result>
  <!--
   name : action interpace를 구현 하지 않은 경우(옵션임) execute()메서드 (클래스 파일참조)
   찾기위해 reflection 되어 하나의 결과를 받아 들인다.
   /helloWorld.jsp : 액션을 실행하기 위한 URL 매핑 처리 (MVC 에서 View로 볼수 있다)
   //-->


 </action>
</package>
 
 <include file="struts-helloWorld.xml" />
  <!--
   매핑 설정을 다음과 같이 include시켜 관리 할 수 있다.
   //-->

</struts>


반응형