태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.


<display-name>
<!-- 자유롭게 기술, '<','>','&' 등의 특수문자는 <![CDATA[...]]>안에 기술 -->
<!-- <description> 자유롭게 기술, '<','>','&' 등의 특수문자는 <![CDATA[...]]>안에 기술 -->

<data-sources>
 <data-source>
  <set-property property="autoCommit" value="true"/>
  <set-property property="description" value="My Data Source"/>
  <set-property property="driverClass" value="com.mysql.jdbc.Driver"/>
  <set-property property="maxCount" value="10"/>
  <set-property property="minCount" value="4"/>
  <set-property property="user" value="username"/>
  <set-property property="password" value="password"/>
  <set-property property="url" value="jdbc:mysql://localhost:3306/database"/>
 </data-source>
</data-sources>

<!--
DataSource dataSource =  (DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY);
-->

<form-beans>
 <form-bean name="boardForm" type="forms.BoardForm">
 <form-bean name="listForm" type="forms.listForm">
</form-beans>

<!--
form-bean에 정의된 내용은 org.apache.struts.action.ActionFormBean클래스에 저장된다.

form-bean의 속성들

className : ActionFormBean을 상속했을 경우에 생성한 클래스명을 기록
dynamic : DynaActionForm을 사용할 경우 true로 지정
name : 생성한 액션폼의 인스턴스명 정의
type : 생성한 액션폼의 패키지명을 포함한 클래스명을 기록

form-bean의 하위 요소들

icon : GUI Tool을 사용할 경우 표시될 icon 이미지의 경로
display-name : GUI Tool을 사용할 경우 표시될 이름
description : form-bean의 설명
set-property : form-bean 속성으로 className이 지정된 경우 전달된 변수
form-property : DynaActionForm을 사용할 경우 DynaActionForm이 가질 변수들을 정의
-->

<global-exceptions>
 <exception type="exception.BoardException" key="exception.board" scope="request" path="/exception/BoardMessages.jsp"/>
</global-exceptions>

<!--
exception의 속성들

bundle : locale 값에 해당하는 에러메시지를 출력할 경우 사용할 프로퍼티 지정
className : ExceptionConfig를 상속했을 경우에 생성한 클래스명을 기록
handler : ExceptionHandler를 상속했을 경우에 생성한 클래스명을 기록
key : 출력할 에러메시지의 프로퍼티의 key를 기록
path : 예외가 발생했을 경우 forward 할 경로를 기록
scope : ActionError를 저장할 스코프 기록
type : exception을 처리할 클래스명

exception의 하위 요소들

icon : GUI Tool을 사용할 경우 표시될 icon 이미지의 경로
display-name : GUI Tool을 사용할 경우 표시될 이름
description : exception의 설명
set-property : exception 속성으로 className이나 handler를 지정한 경우 전달된 변수
 -->

<global-forwards>
 <forward name="common" path="/index.jsp" redirect="false"/>
</global-forwards>

<!--
module내에서 공통적으로 사용할 forward를 정의
forwards요소에 정의된 값은 org.apache.struts.action.ActionForward에 저장됨

forward의 속성들

className : ActionForward를 상속받은 클래스명을 기록
contextRelative : "true"로 지정할 경우 application의 Context path로 부터 경로가 사용된다
module : path 속성으로 지정된 경로가 여기에 지정된 경로의 상대경로로 사용된다.
name : Action에서 사용할 논리적인 이름
path : forward의 실제 경로
redirect : 초기화를 해서 forward를 할 경우 사용
 -->

<action-mappings>
 <action path="/login" type="org.apache.struts.actions.ForwardAction" scope="request" parameter="/login/login.jsp" validate="false"/>
 <action path="/loginProc" type="actions.LoginAction" name="loginForm" scope="request" input="/login/login.jsp" validate="true">
  <forward name="success" redirect="false" path="/member/main.jsp"/>
  <forward name="success" redirect="false" path="/member/main.jsp"/>
 </action>
</action-mapping>

<!--
struts-config.xml의 가장 중요한 요소로 org.apache.struts.action.ActionMapping에 저장된다.
attribute : ActionForm의 이름, 지정하지 않으면 name 속성에서 지정한 이름을 사용한다.
className : ActionMapping을 상속받은 클래스명을 기록
forward : 포워드할 경로를 지정
include : 인클루드할 경로를 지정
input : ActionForm에서 에러가 발생하면 되돌아갈 경로 지정
name :  ActionForm의 이름
path :  <action> 요소가 매핑 될 request경로
parameter : Action에 전달해줄 변수, mapping.getParameter()메소드를 통해서 사용
prefix : reqeust 파라메터 중에서 특정 이름으로 시작하는 변수만 ActionForm에서 사용할 때 사용, name 속성이 지정되어 있어야 한다. 예) prefix="mem_"
suffix : reqeust 파라메터 중에서 특정 이름으로 끝나는 변수만 ActionForm에서 사용할 때 사용, name 속성이 지정되어 있어야 한다. 예) prefix="Shop"
roles : 특정 사용자만 접근하도록 할 때 사용, 예) role="admin,manager"
type : Action 클래스명
unknown : "true"로 지정하면 정의되지 않은 요청 경로가 있을 경우 기본으로 호출 될 경로로 사용, module 안에서 한개만 사용할 수 있다
validate : "true"로 지정하면 ActionForm의 validate()를 호출한다.

action의 하위 요소들

icon : GUI Tool을 사용할 경우 표시될 icon 이미지의 경로
display-name : GUI Tool을 사용할 경우 표시될 이름
description : action의 설명
set-property : action의 속성으로 className을 지정한 경우 ActionMapping에 전달된 변수
exception : Action 내에서 발생할 수 있는 exception 처리를 지정
forward : Action 내에서 선택할 수 있는 ActionForward를 지정
 -->

<controller contentType="text/html; charset=utf-8" locale="true"/>

<!--
bufferSize : 파일 업로드를 처리할 때 사용할 버퍼 메모리 크기, default값 4096Byte
className  : ControllerConfig를 상속받은 클래스명을 기록
contentType : module의 기본 컨텐츠타입 지정, default값 "text/html", 다국어를 위해 "text/html; charset=utf-8"을 사용하는 것을 권장
forwardPatten : forward 요소의 path 속성이 "/"로 시작하고 contextRelative가 true인 경우의 매핑을 정의, default 값은 $M$P로 되어 있음,
"$M" : module prefix를 매핑
"$P" : forward요소의 path 속성을 매핑
"$$" : '$'문자를 매핑
inputForward : "true"로 지정하면 global-forward 또는 action의 forward 요소의 이름을 action의 input 속성의 값으로 사용한다. default값은 "false"이며 action의 input 속성 값으로 action의 path를 사용한다.
locale : "true"로 지정하면 사용자의 locale 값을 세션에 저정한다.
maxFileSize : 업로드 파일의 최대 크기를 지정, "K", "M", "G"단위를 사용, default 값은 "250M"
memFileSize : 메모리에 보관할 업로드 파일의 최대 크기를 지정, 파일의 크기가 이 값보다 크면 tempDir에 저장함, default값은 "250K"
multipartClass : multipart request를 처리할 클래스명, 지정하지 않으면 CommonsMultipartRequestHandler가 사용됨
nocache : "true"로 지정하면 Browser의 캐시기능을 사용하지 않음
pagePattern : struts tag library의 page 속성에 대한 패턴 정의,  default값은 "$M$P"
processorClass : RequestProcessor를 상속받은 클래스명을 기록
tempDir : 파일 업로드에 사용하는 임시폴더
 -->

<message-resource parameter="resource/Messages"/>

<!--
className : MessageResourcesConfig를 상속받은 클래스명을 기록
factory : MessageResourcesFactory를 상속받은 클래스명을 기록, default값은 PropertyMessageResourcesFactory를 사용
key : 메시지 리소스가 ServletContext에 저장될때 사용될 이름, default값은 Globals.MESSAGES_KEY, 루트 모듈이 아닌 하위 모듈일때에는 "/"와 모듈 접두사(모듈명)가 key값 뒤에 붙는다.
null : "true"로 지정하면  메시지 key가 없을 때 null을 반환
parameter : MessageResourcesFactory에 전달할 메지지 프로퍼티 지정
 -->

 <plug-in className="org.apache.struts.tiles.TilesPlugin">
 <set-property property="definition-config" value="/WEB-INF/tiles/tiles-defs.xml"/>
 <set-property property="definitions-debug" value="2"/>
 </plug-in>
  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
 <set-property property="pathnames" value="/WEB-INF/validator/validator-rules.xml,/WEB-INF/validator/validator.xml"/>
 </plug-in>




출처 : 파워유저가 알려주는 스트럿츠프로그래밍, 137-148, 가메출판사

top

Trackback Address :: http://www.ssial.com/trackback/287 관련글 쓰기

  1. 2011/06/15 17:26 댓글주소 | 수정/삭제 | 댓글

    비밀댓글입니다

  2. Chanel Outlet 2011/09/17 21:48 댓글주소 | 수정/삭제 | 댓글

    Time is what you make of it.

  3. Coach Outlet Online 2011/11/15 12:44 댓글주소 | 수정/삭제 | 댓글

    I'm happy I found this blog ! It's very good and thank you for sharing it !

Write a comment


[STRUTS]validator 기능 사용하기

정의 순서.

1.
 액션폼빈에Validator처리를 행한다는 기술을 한다.

2.
 액션폼빈의 각 속성에 적용할Validator룰을 validation.xml에 기술한다. Validator자체의 동작은 validator-rules.xml에 정의된다. validator-rules.xml은 사전에 정의되어 있는 것을 사용한다.

3.
 메세지 리소스 파일에validation.xml의 룰에 만족하지 않았을 때표시할 에러메세지를 기술한다.

4.
 에러 메세지를 표시하기위한 JSP프로그램을 작성한다.

5.
 struts-config.xml에 Validator관련 설정을 한다.
 


1. 어플리케이션 폼빈 작성

【ExValidatorForm.java】

package struts;


import org.apache.struts.validator.*;

import org.apache.struts.action.*;


//Validator를 사용하는 경우는ValidatorForm클래스를 계승합니다.

//그 외는 일반적인 어플리케이션 폼빈의 작성방법과 같습니다.

public final class ExValidatorForm extends ValidatorForm {

  private String requireV;

  private String validwhenV;

  private String countV;

  private String patternV;

  private String dateV;

  private String rangeV;

  private String emailV;


  public void setRequireV(String requireV)

    {this.requireV = requireV;}

  public void setValidwhenV(String validwhenV)

    {this.validwhenV = validwhenV;}

  public void setCountV(String countV)

    {this.countV = countV;}

  public void setPatternV(String patternV)

    {this.patternV = patternV;}

  public void setDateV(String dateV)

    {this.dateV = dateV;}

  public void setRangeV(String rangeV)

    {this.rangeV = rangeV;}

  public void setEmailV(String emailV)

    {this.emailV = emailV;}


  public String getRequireV() {return requireV;}

  public String getValidwhenV() {return validwhenV;}

  public String getCountV() {return countV;}

  public String getPatternV() {return patternV;}

  public String getDateV() {return dateV;}

  public String getRangeV() {return rangeV;}

  public String getEmailV() {return emailV;}

}
 



2. validation.xml 작성

【validation.xml】

<?xml version="1.0" encoding="ISO-8859-1" ?>


<!DOCTYPE form-validation PUBLIC

 "-//Apache Software Foundation//

  DTD Commons Validator Rules Configuration 1.1.3//EN"

 "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">


<form-validation>

  <formset>

    <!-- 적용할 어플리케이션 폼빈을 논리명으로 지정 -->

    <form name="ExValidator">

      <!-- required 룰 지정 -->

      <field property="requireV" depends="required">

      </field>

      <!-- validwhen룰 지정

           validwhen의 조건식을 test변수로 지정

           *this*는 프로퍼티 validwhenV를 나타냄 -->

      <field property="validwhenV" depends="validwhen">

        <msg name="validwhen" key="errors.validwhen" />

        <var>

        <var-name>test</var-name>

        <var-value>

          ((*this* != null) and (countV != null))

        </var-value>

        </var>

      </field>

      <!-- minlength룰 지정

           minlength변수로 조건의 최저입력수를 지정 -->

      <field property="countV" depends="minlength">

        <var>

        <var-name>minlength</var-name>

        <var-value>4</var-value>

        </var>

      </field>

      <!-- mask룰 지정

           mask변수로 조건패턴을 지정 -->

      <field property="patternV" depends="mask">

        <var>

        <var-name>mask</var-name>

        <var-value>^[a-zA-Z]*$</var-value>

        </var>

      </field>

      <!-- date룰 지정

           datePattern변수로 조건의 일자 패턴을 지정 -->

      <field property="dateV" depends="date">

        <msg name="date" key="errors.date" />

        <var>

        <var-name>datePattern</var-name>

        <var-value>yyyy/mm/dd</var-value>

        </var>

      </field>

      <!-- intRange 룰 지정

           max변수, min변수로 조건의 범위를 지정 -->

      <field property="rangeV" depends="intRange">

        <var>

          <var-name>min</var-name>

          <var-value>4</var-value>

        </var>

        <var>

          <var-name>max</var-name>

          <var-value>16</var-value>

        </var>

      </field>

      <!-- email 룰 지정 -->

      <field property="emailV" depends="email">

      </field>

    </form>

  </formset>

</form-validation>
 



3. 메세지 리소스 파일 작성

【application.properties】
 

errors.required =requireV is wrong.<br>

errors.validwhen=validwhenV is wrong.<br>

errors.minlength=countV is wrong.<br>

errors.invalid  =patternV is wrong.<br>

errors.date     =dateV is wrong.<br>

errors.range    =rangeV is wrong.<br>

errors.email    =emailV is wrong.<br>
 
 



4. JSP 작성

【error.jsp】Validator룰에 만족하지 않았을 때에 표시할 에러화면

<%@ page contentType="text/html; charset=Shift_JIS" %>

<%@ taglib uri="/tags/struts-html" prefix="html" %>

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>


<html:html>

<head><title>에러화면</title></head>

<body>


에러 메세지

<br>
<%-- <html:messages>태그로 에러 메세지를 표시합니다.

에러 메세지를 표시할 때는message속성을 false로 합니다. --%>

<html:messages id="msg" message="false">

  <%-- filter속성을 false로 함으로써 메세지에

       HTML태그를 쓸 수 있습니다. True로 하면 HTML태그가 있는 경우 치환문자(&lt;, &gt; 등)으로 변환됩니다. --%>

  <bean:write name="msg" ignore="true" filter="false"/>

</html:messages>


</body>

</html:html>
 


【exValidator.jsp】Validator체크를 하는데 사용될 입력폼 화면

<%@ page contentType="text/html; charset=Shift_JIS" %>

<%@ taglib uri="/tags/struts-html" prefix="html" %>


<html:html>

<head><title>Validator처리</title></head>

<body>


<html:form action="/ExValidator">

  필수입력

  <br>

  <html:text property="requireV" size="16"/>

  <br><br>

  validwhen

  <br>

  <html:text property="validwhenV" size="16"/>

  <br><br>

  문자수확인

  <br>

  <html:text property="countV" size="16"/>

  <br><br>

  패턴확인

  <br>

  <html:text property="patternV" size="16"/>

  <br><br>

  일자확인

  <br>

  <html:text property="dateV" size="16"/>

  <br><br>

  범위확인

  <br>

  <html:text property="rangeV" size="16"/>

  <br><br>

  메일 어드레스 확인

  <br>

  <html:text property="emailV" size="16"/>

  <br><br>

  <html:submit property="submit" value="송신"/>

</html:form>


</body>

</html:html>
 



5. struts-config.xml 작성

【struts-config.xml】

<?xml version="1.0" encoding="Shift_JIS"?>

<!DOCTYPE struts-config PUBLIC

 "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"

 "http://struts.apache.org/dtds/struts-config_1_2.dtd">


<struts-config>


 <!-- 액션폼빈 지정 -->

 <form-beans>

  <form-bean name="ExValidator"

             type="struts.ExValidatorForm" />

 </form-beans>


 <!-- 액션 클래스 지정 -->

 <action-mappings>

  <!-- Validator를 사용하는 경우validate속성을 true로 지정.

       Validator 에러를 표시할 화면을 input속성으로 지정 -->

  <action path="/ExValidator"

          type="struts.ExValidatorAction"

          name="ExValidator"

          scope="request"

          validate="true"

          input="/error.jsp">

   <forward name="info" path="/exValidator2.jsp"/>

  </action>

 </action-mappings>


 <!-- 메세지 리소스 파일 지정 -->

 <message-resources parameter="resources.application"/>


 <!-- Validator 지정. 프로퍼티 pathnames의 값에

      validator-rules.xml과 validation.xml을 지정 -->

 <plug-in className="org.apache.struts.validator.ValidatorPlugIn">

  <set-property property="pathnames"

   value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>

 </plug-in>


</struts-config>
 



응용처리

1. 복수조건지정
<file>태그의 depends속성에 값을 복수 지정함으로써 체크할 조건을 복수로 지정할 수 있습니다. email형식 체크와 필수입력 체크 등으로 조건을 조합하여 지정할 수 있습니다.

【depends속성에 복수조건 지정】

<!-- email형식 체크와 필수입력 체크를 지정 -->

<field property="emailV" depends="email,required">

</field>

2.에러 메세지에 변수를 사용
<field>태그에 <argn>태그(n은 0~3까지)를 지정함으로서 에러 메세지에 상황에 맞는 메세지 문자를 넣을 수 있습니다. 이 메세지 문자는 메세지 리소스 파일을 이용하여 지정할 수 있거나, 직접 넣거나, <var>태그의 변수지정으로 넣을 수 있습니다.

직접 넣거나, <var>태그의 변수를 지정하는 경우에는 <argn>태그의 리소스 속성을 “false”로 해야 합니다.

【<argn>태그 지정】

・・・・・

<field property="countV" depends="minlength">

  <!-- 메세지에 "minlength.msg"을 지정 -->

  <arg0 key="minlength.msg" />

  <!-- <var>태그를 이용하여 minlength를 지정 -->

  <arg1 key="${var:minlength}" resource="false" />

  <var>

    <var-name>minlength</var-name>

    <var-value>4</var-value>

  </var>

</field>

・・・・・

【메세지 리소스 파일】

errors.minlength={0} needs over {1} characters.

minlength.msg=minlength

3.메세지 리소스 파일의 키를 지정
<field>태그에 <msg>태그를 지정함으로서 참조되는 메세지 리소스 파일의

키를 변경할 수가 있다.

【<msg>태그 지정】

・・・・・

<field property="requireV" depends="required">

  <!--에러시의 메세지 리소스 파일의 키를

       "errors.original.required" 로 변경-->

  <msg name="required" key="errors.original.required" />

</field>

・・・・・

4.동적 액션폼빈에Validator를 사용
동적 액션폼빈에 Validator를 사용할 수 있다.

struts-config.xml의 태그의 타입속성에DynaValidatorForm을 지정하는 것만으로 사용할 수 있다.

다른 부분은 액션폼빈의Validator 사용방법과 동일하다.

【<form-bean>태그에 DynaValidatorFrom을 지정】

・・・・・

  <form-beans>

    <!-- type속성에 DynaValidatorForm을 지정 -->

    <form-bean

     name="DynaForm"

     type="org.apache.struts.validator.DynaValidatorForm">

     <form-property

      name="requireV"

      type="java.lang.String" />

    </form-bean>

  </form-beans>


  <action-mappings>

    <action path="/ExValidator"

            type="struts.ExValidatorAction"

            name="DynaForm"

            scope="request"

            validate="true"

            input="/error.jsp">

      <forward name="info" path="/exValidator2.jsp"/>

    </action>

  </action-mappings>

・・・・・



출처 : http://dojeun.egloos.com/317876

top

Trackback Address :: http://www.ssial.com/trackback/284 관련글 쓰기

Write a comment


http://springide.org/project/wiki/SpringideGuide
top

Trackback Address :: http://www.ssial.com/trackback/276 관련글 쓰기

  1. 11 2010/08/03 07:46 댓글주소 | 수정/삭제 | 댓글

    11

  2. Chanel Outlet 2011/09/17 21:29 댓글주소 | 수정/삭제 | 댓글

    Time is what you make of it.

  3. Burberry Bags 2011/10/13 17:04 댓글주소 | 수정/삭제 | 댓글

    I'm happy I found this blog! From time to time students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. Thanks.

  4. Coach Outlet Online 2011/11/15 12:48 댓글주소 | 수정/삭제 | 댓글

    I'm happy I found this blog ! It's very good and thank you for sharing it !

  5. Coach Outlet Online 2011/11/15 12:48 댓글주소 | 수정/삭제 | 댓글

    I'm happy I found this blog ! It's very good and thank you for sharing it !

  6. Christian Louboutin Outlet 2011/12/03 11:26 댓글주소 | 수정/삭제 | 댓글

    Choose http://www.shoesdna.com/ Christian Louboutin Outlet have skill, also choose to wear http://www.shoesdna.com/ Christian Louboutin Sample Sale also has the skill. Wear http://www.toryburch.ws/ tory burch flats outlet to work and go out, can make with a figure of perfect elegance. However wear http://www.toryburch.ws/ tory burch shoes on sale undeserved, can make the person general malaise.
    http://www.shoesdna.com/sales-promotion-category-127.html cheap red bottom shoes
    http://www.shoesdna.com/short-boots-category-3.html christian louboutin on sale
    http://www.shoesdna.com/sneakers-category-119.html christian louboutin spiked sneakers
    http://www.shoesdna.com/tall-boots-category-126.html christian louboutin thigh high boots black
    http://www.shoesdna.com/autumnwinter-shoes-category-125.html christian louboutin ankle boots on sale
    http://www.shoesdna.com/wedges-category-118.html christian louboutin wedges
    http://www.shoesdna.com/flats-category-5.html louboutin flats with studs
    http://www.toryburch.ws/category/tory-burch-wedges/ Tory Burch Wedge Sandals
    http://www.toryburch.ws/category/tory-burch-handbags/ tory burch bags outlet
    http://www.louboutinchaussuress.com/ christian louboutin pas cher avis

Write a comment


http://www.easymock.org/
top

Trackback Address :: http://www.ssial.com/trackback/271 관련글 쓰기

  1. Christian Louboutin Outlet 2011/12/03 11:27 댓글주소 | 수정/삭제 | 댓글

    Choose http://www.shoesdna.com/ Christian Louboutin Outlet have skill, also choose to wear http://www.shoesdna.com/ Christian Louboutin Sample Sale also has the skill. Wear http://www.toryburch.ws/ tory burch flats outlet to work and go out, can make with a figure of perfect elegance. However wear http://www.toryburch.ws/ tory burch shoes on sale undeserved, can make the person general malaise.
    http://www.shoesdna.com/sales-promotion-category-127.html cheap red bottom shoes
    http://www.shoesdna.com/short-boots-category-3.html christian louboutin on sale
    http://www.shoesdna.com/sneakers-category-119.html christian louboutin spiked sneakers
    http://www.shoesdna.com/tall-boots-category-126.html christian louboutin thigh high boots black
    http://www.shoesdna.com/autumnwinter-shoes-category-125.html christian louboutin ankle boots on sale
    http://www.shoesdna.com/wedges-category-118.html christian louboutin wedges
    http://www.shoesdna.com/flats-category-5.html louboutin flats with studs
    http://www.toryburch.ws/category/tory-burch-wedges/ Tory Burch Wedge Sandals
    http://www.toryburch.ws/category/tory-burch-handbags/ tory burch bags outlet
    http://www.louboutinchaussuress.com/ christian louboutin pas cher avis

  2. Nike Air Max 2009 2012/02/09 12:02 댓글주소 | 수정/삭제 | 댓글

    http://www.onlinesneakers2012.com/
    This was very informative. I have been reading your blog a lot over the past few days and it has earned a place in my bookmarks.

Write a comment


package com.kame.struts2.architecture.valuestack;

import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;

public class ValueStackTest {
 public static void main(String[] args) {
  Person person = new Person();
  Animal animal = new Animal();
 
  ConfigurationManager configurationManager = new ConfigurationManager();
        configurationManager.addContainerProvider(new XWorkConfigurationProvider());
        Configuration config = configurationManager.getConfiguration();
        Container container = config.getContainer();

  // 스택을 만들어서 animal과 person을 push한다.
  ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();

  stack.push(animal);
  stack.push(person);

  stack.setValue("name", "Johnson"); // person.setName("Johnson");
  stack.setValue("salary", 5000000); // person.setSalary(5000000);
  stack.setValue("species", "pug"); // animal.setSpecies("pug");

  System.out.println(person);
  System.out.println(animal);

  System.out.println(stack.findValue("name")); // person.getName();
  System.out.println(stack.findValue("species")); // animal.getSpecies();
  System.out.println(stack.findValue("salary")); // person.getSalary();
 }
}

top

Trackback Address :: http://www.ssial.com/trackback/259 관련글 쓰기

  1. Burberry Bags 2011/10/13 16:51 댓글주소 | 수정/삭제 | 댓글

    I'm happy I found this blog! From time to time students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. Thanks.

  2. Coach Factory Online 2011/12/11 22:57 댓글주소 | 수정/삭제 | 댓글

    댓글주소 | 수정/삭제 | 댓글

  3. Coach Factory Outlet Online 2011/12/14 15:55 댓글주소 | 수정/삭제 | 댓글

    Great Coach Factory Outlet Online
    . A lot of useful information here. I’m sending it to some friends!

  4. Burberry Shop Online 2012/01/11 15:22 댓글주소 | 수정/삭제 | 댓글

    <p><strong><a href="http://www.burberrydiscount.org/">Burberry Discount</a></strong> developed a local community utilizing bags to write about in her appreciation and consciousness and also to preserve people within your loop about high quality replica artist handbag sites, such as touch bags.<br>
    <a href="http://www.burberryoutletshoponline.com/"><strong>Burberry Shop Online</strong></a> puts inside the work to can be found throughout only the extremely perfect high quality sites, steering toward magnitude of placing her on the internet protection inside the collection by attempting to purchase a replica artist handbag by method of the website itself.<br>
    <a href="http://www.onlinesburberryoutlet.com/"><strong>Burberry Outlet</strong></a> then talks concerning the website on blog of handbags. Luckily, these various quality websites are acquiring shut affordable inside the droves to make certain that people aren't scammed away from their hard-earned money.</p>

Write a comment


http://struts.apache.org/1.3.10/faqs/validator.html

http://struts.apache.org/1.3.10/apidocs/org/apache/struts/validator/package-summary.html#package_description
top

Trackback Address :: http://www.ssial.com/trackback/254 관련글 쓰기

  1. Chanel Outlet 2011/09/17 21:32 댓글주소 | 수정/삭제 | 댓글

    Time is what you make of it.

  2. Burberry Bags 2011/10/13 17:09 댓글주소 | 수정/삭제 | 댓글

    I'm happy I found this blog! From time to time students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. Thanks.

  3. Coach Outlet Online 2011/11/15 12:23 댓글주소 | 수정/삭제 | 댓글

    It's very good!Thank you for sharing it!I like buying handbags of the internet website:http://www.mycoachoutletstoreonline.com

  4. Coach Outlet Online 2011/11/15 12:24 댓글주소 | 수정/삭제 | 댓글

    It's very good!Thank you for sharing it!I like buying handbags of the internet website:http://www.mycoachoutletstoreonline.com

  5. Coach Factory Online 2011/12/11 22:58 댓글주소 | 수정/삭제 | 댓글

    댓글주소 | 수정/삭제 | 댓글

  6. Coach Factory Outlet Online 2011/12/14 15:55 댓글주소 | 수정/삭제 | 댓글

    Great Coach Factory Outlet Online
    . A lot of useful information here. I’m sending it to some friends!

  7. Burberry Shop Online 2012/01/11 15:22 댓글주소 | 수정/삭제 | 댓글

    <p><strong><a href="http://www.burberrydiscount.org/">Burberry Discount</a></strong> developed a local community utilizing bags to write about in her appreciation and consciousness and also to preserve people within your loop about high quality replica artist handbag sites, such as touch bags.<br>
    <a href="http://www.burberryoutletshoponline.com/"><strong>Burberry Shop Online</strong></a> puts inside the work to can be found throughout only the extremely perfect high quality sites, steering toward magnitude of placing her on the internet protection inside the collection by attempting to purchase a replica artist handbag by method of the website itself.<br>
    <a href="http://www.onlinesburberryoutlet.com/"><strong>Burberry Outlet</strong></a> then talks concerning the website on blog of handbags. Luckily, these various quality websites are acquiring shut affordable inside the droves to make certain that people aren't scammed away from their hard-earned money.</p>

Write a comment


http://struts.apache.org/2.0.14/docs/struts-defaultxml.html

<?xml version="1.0" encoding="UTF-8" ?>
<!--
/*
 * $Id$
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
-->

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
    <bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />

    <bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" class="com.opensymphony.xwork2.DefaultActionProxyFactory"/>
    <bean type="com.opensymphony.xwork2.ActionProxyFactory" name="struts" class="org.apache.struts2.impl.StrutsActionProxyFactory"/>

    <bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="tiger" class="com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer"/>
    <bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="notiger" class="com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer"/>
    <bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="struts" class="com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer"/>

    <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="struts" class="org.apache.struts2.dispatcher.mapper.DefaultActionMapper" />
    <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="composite" class="org.apache.struts2.dispatcher.mapper.CompositeActionMapper" />
    <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful" class="org.apache.struts2.dispatcher.mapper.RestfulActionMapper" />
    <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful2" class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" />

    <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="struts" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default" optional="true"/>
    <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="jakarta" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default" optional="true" />

    <bean type="org.apache.struts2.views.TagLibrary" name="s" class="org.apache.struts2.views.DefaultTagLibrary" />

    <bean class="org.apache.struts2.views.freemarker.FreemarkerManager" name="struts" optional="true"/>
    <bean class="org.apache.struts2.views.velocity.VelocityManager" name="struts" optional="true" />

    <bean class="org.apache.struts2.components.template.TemplateEngineManager" />
    <bean type="org.apache.struts2.components.template.TemplateEngine" name="ftl" class="org.apache.struts2.components.template.FreemarkerTemplateEngine" />
    <bean type="org.apache.struts2.components.template.TemplateEngine" name="vm" class="org.apache.struts2.components.template.VelocityTemplateEngine" />
    <bean type="org.apache.struts2.components.template.TemplateEngine" name="jsp" class="org.apache.struts2.components.template.JspTemplateEngine" />

    <bean type="com.opensymphony.xwork2.util.XWorkConverter" name="xwork1" class="com.opensymphony.xwork2.util.XWorkConverter" />
    <bean type="com.opensymphony.xwork2.util.XWorkConverter" name="struts" class="com.opensymphony.xwork2.util.AnnotationXWorkConverter" />

    <bean type="com.opensymphony.xwork2.TextProvider" name="xwork1" class="com.opensymphony.xwork2.TextProviderSupport" />
    <bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" />

	<bean type="org.apache.struts2.components.UrlRenderer" name="struts" class="org.apache.struts2.components.ServletUrlRenderer"/>
	
    <!--  Only have static injections -->
    <bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />
    <bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" />
    <bean class="com.opensymphony.xwork2.util.OgnlValueStack" static="true" />
    <bean class="org.apache.struts2.dispatcher.Dispatcher" static="true" />
    <bean class="org.apache.struts2.components.Include" static="true" />
    <bean class="org.apache.struts2.dispatcher.FilterDispatcher" static="true" />
    <bean class="org.apache.struts2.views.util.ContextUtil" static="true" />
    <bean class="org.apache.struts2.views.util.UrlHelper" static="true" />

    <package name="struts-default" abstract="true">
        <result-types>
            <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
            <result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
            <result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
            <result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/>
            <result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/>
            <result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
            <result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/>
            <result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/>
            <result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>
            <result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" />
        </result-types>

        <interceptors>
            <interceptor name="alias" class="com.opensymphony.xwork2.interceptor.AliasInterceptor"/>
            <interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>
            <interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor"/>
            <interceptor name="conversionError" class="org.apache.struts2.interceptor.StrutsConversionErrorInterceptor"/>
            <interceptor name="createSession" class="org.apache.struts2.interceptor.CreateSessionInterceptor" />
            <interceptor name="debugging" class="org.apache.struts2.interceptor.debugging.DebuggingInterceptor" />
            <interceptor name="externalRef" class="com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor"/>
            <interceptor name="execAndWait" class="org.apache.struts2.interceptor.ExecuteAndWaitInterceptor"/>
            <interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/>
            <interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/>
            <interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor"/>
            <interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/>
            <interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/>
            <interceptor name="scopedModelDriven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/>
            <interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/>
            <interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor"/>
            <interceptor name="staticParams" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/>
            <interceptor name="scope" class="org.apache.struts2.interceptor.ScopeInterceptor"/>
            <interceptor name="servletConfig" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/>
            <interceptor name="sessionAutowiring" class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/>
            <interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/>
            <interceptor name="token" class="org.apache.struts2.interceptor.TokenInterceptor"/>
            <interceptor name="tokenSession" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/>
            <interceptor name="validation" class="org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor"/>
            <interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"/>
            <interceptor name="store" class="org.apache.struts2.interceptor.MessageStoreInterceptor" />
            <interceptor name="checkbox" class="org.apache.struts2.interceptor.CheckboxInterceptor" />
            <interceptor name="profiling" class="org.apache.struts2.interceptor.ProfilingActivationInterceptor" />
            <interceptor name="roles" class="org.apache.struts2.interceptor.RolesInterceptor" />
            <interceptor name="jsonValidation" class="org.apache.struts2.interceptor.validation.JSONValidationInterceptor" />
            <interceptor name="annotationWorkflow" class="com.opensymphony.xwork2.interceptor.annotations.AnnotationWorkflowInterceptor" />

            <!-- Basic stack -->
            <interceptor-stack name="basicStack">
                <interceptor-ref name="exception"/>
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="params"/>
                <interceptor-ref name="conversionError"/>
            </interceptor-stack>

            <!-- Sample validation and workflow stack -->
            <interceptor-stack name="validationWorkflowStack">
                <interceptor-ref name="basicStack"/>
                <interceptor-ref name="validation"/>
                <interceptor-ref name="workflow"/>
            </interceptor-stack>
            
            <!-- Sample JSON validation stack -->
            <interceptor-stack name="jsonValidationWorkflowStack">
                <interceptor-ref name="basicStack"/>
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel</param>
                </interceptor-ref>
                <interceptor-ref name="jsonValidation"/>
                <interceptor-ref name="workflow"/>
            </interceptor-stack>

            <!-- Sample file upload stack -->
            <interceptor-stack name="fileUploadStack">
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="basicStack"/>
            </interceptor-stack>

            <!-- Sample model-driven stack  -->
            <interceptor-stack name="modelDrivenStack">
                <interceptor-ref name="modelDriven"/>
                <interceptor-ref name="basicStack"/>
            </interceptor-stack>

            <!-- Sample action chaining stack -->
            <interceptor-stack name="chainStack">
                <interceptor-ref name="chain"/>
                <interceptor-ref name="basicStack"/>
            </interceptor-stack>

            <!-- Sample i18n stack -->
            <interceptor-stack name="i18nStack">
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="basicStack"/>
            </interceptor-stack>

            <!-- An example of the params-prepare-params trick. This stack
                 is exactly the same as the defaultStack, except that it
                 includes one extra interceptor before the prepare interceptor:
                 the params interceptor.

                 This is useful for when you wish to apply parameters directly
                 to an object that you wish to load externally (such as a DAO
                 or database or service layer), but can't load that object
                 until at least the ID parameter has been loaded. By loading
                 the parameters twice, you can retrieve the object in the
                 prepare() method, allowing the second params interceptor to
                 apply the values on the object. -->
            <interceptor-stack name="paramsPrepareParamsStack">
                <interceptor-ref name="exception"/>
                <interceptor-ref name="alias"/>
                <interceptor-ref name="params"/>
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="chain"/>
                <interceptor-ref name="modelDriven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="staticParams"/>
                <interceptor-ref name="params"/>
                <interceptor-ref name="conversionError"/>
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel</param>
                </interceptor-ref>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel</param>
                </interceptor-ref>
            </interceptor-stack>

            <!-- A complete stack with all the common interceptors in place.
                 Generally, this stack should be the one you use, though it
                 may do more than you need. Also, the ordering can be
                 switched around (ex: if you wish to have your servlet-related
                 objects applied before prepare() is called, you'd need to move
                 servlet-config interceptor up.

                 This stack also excludes from the normal validation and workflow
                 the method names input, back, and cancel. These typically are
                 associated with requests that should not be validated.
                 -->
            <interceptor-stack name="defaultStack">
                <interceptor-ref name="exception"/>
                <interceptor-ref name="alias"/>
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="chain"/>
                <interceptor-ref name="debugging"/>
                <interceptor-ref name="profiling"/>
                <interceptor-ref name="scopedModelDriven"/>
                <interceptor-ref name="modelDriven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="staticParams"/>
                <interceptor-ref name="params">
                  <param name="excludeParams">dojo\..*</param>
                </interceptor-ref>
                <interceptor-ref name="conversionError"/>
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
            </interceptor-stack>

            <!-- The completeStack is here for backwards compatibility for
                 applications that still refer to the defaultStack by the
                 old name -->
            <interceptor-stack name="completeStack">
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>

            <!-- Sample execute and wait stack.
                 Note: execAndWait should always be the *last* interceptor. -->
            <interceptor-stack name="executeAndWaitStack">
                <interceptor-ref name="execAndWait">
                    <param name="excludeMethods">input,back,cancel</param>
                </interceptor-ref>
                <interceptor-ref name="defaultStack"/>
                <interceptor-ref name="execAndWait">
                    <param name="excludeMethods">input,back,cancel</param>
                </interceptor-ref>
            </interceptor-stack>

       </interceptors>

        <default-interceptor-ref name="defaultStack"/>
    </package>

</struts>
top

Trackback Address :: http://www.ssial.com/trackback/239 관련글 쓰기

Write a comment


http://struts.apache.org/2.0.11/docs/big-picture.data/Struts2-Architecture.png
top

Trackback Address :: http://www.ssial.com/trackback/237 관련글 쓰기

Write a comment


http://www.laliluna.de/first-hibernate-example-tutorial.html
top

Trackback Address :: http://www.ssial.com/trackback/227 관련글 쓰기

  1. Chanel Outlet 2011/09/17 21:33 댓글주소 | 수정/삭제 | 댓글

    Time is what you make of it.

  2. Cheap jerseys 2011/12/14 17:33 댓글주소 | 수정/삭제 | 댓글



    I think if we walk to other blog we most comment to give appreciate for owner.http://www.cheapjerseyswholesale.com

  3. cheap Jerseys 2011/12/20 21:45 댓글주소 | 수정/삭제 | 댓글


    http://www.topnflnhl.us cheap jerseys
    http://www.cheapmonclerjacketsell.com/ (Cheap moncler jackets)
    http://www.fansportsjerseys.com/ (cheap nfl jerseys)
    http://www.nfljerseysoutlets.us/ (NFL Jerseys Cheap)
    http://www.cheapjerseysoutlets.com/ (NFL Jerseys Cheap)
    http://www.realnbajerseys.com/ (NBA Jerseys Cheap)
    http://www.facebook.com/topnflnhlus (cheap nfl jerseys)
    http://www.cheapbagshops.com/ (cheap bags)
    http://www.cheapsalesunglasses.com/ (cheap oakey sunglasses)
    http://www.birkenstocksandals.cc/ (birkenstock sandals sale)
    http://www.cheapbirkenstock.us/ (cheap birkenstock sale)
    http://www.nbajerseysoutlet.com/ (nba cheap jerseys)
    http://www.nbajerseysoutlet.us/ (nba jerseys cheap)
    http://www.onestopshopjerseys.com/ (cheap jerseys)
    http://www.sportsjerseyslocker.com/ (nfl jerseys cheap)
    http://www.classicsportsjerseys.com/ (cheap jerseys nfl)
    http://www.fansportsjerseys.com/ (cheap nfl jerseys)
    http://www.gucciclothing.us/ (gucci clothing cheap)

Write a comment


http://www.jamesholmes.com/StrutsTCR/ 

http://www.jamesholmes.com/struts/console/
top

Trackback Address :: http://www.ssial.com/trackback/165 관련글 쓰기

  1. Burberry Bags 2011/10/13 17:03 댓글주소 | 수정/삭제 | 댓글

    I'm happy I found this blog! From time to time students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. Thanks.

Write a comment