日期:2014-05-17  浏览次数:21256 次

日系框架之seasar2(Teeda支援HTML模板)

其实Teeda还支持HTML模板。

  建立工程如下图:

?日系框架之seasar2(Teeda支援HTML模板)

  所需lib列表如下:

aopalliance-1.0.jar
commons-collections-3.1.jar
commons-el-1.0.jar
commons-fileupload-1.2.jar
commons-io-1.3.2.jar
commons-lang-2.1.jar
commons-logging-1.1.jar
geronimo-jta_1.1_spec-1.0.jar
javassist-3.4.ga.jar
jcaptcha-all-1.0-RC6.jar
jstl-1.1.2.jar
log4j-1.2.13.jar
ognl-2.6.9-patch-20070908.jar
poi-3.0-FINAL.jar
portlet-api-1.0.jar
s2-extension-2.4.28.jar
s2-framework-2.4.28.jar
s2-tiger-2.4.28.jar
teeda-ajax-1.0.13-sp4.jar
teeda-tiger-1.0.13-sp4.jar
xercesImpl-2.6.2.jar
xmlParserAPIs-2.6.2.jar
teeda-core-1.0.13-sp4.jar
teeda-extension-1.0.13-sp4.jar

  代码依次为:

  HogeOutputRenderer.java

packagecom.teeda.render;
importjava.io.IOException;
importjavax.faces.component.html.HtmlOutputText;
importjavax.faces.context.FacesContext;
importorg.seasar.teeda.extension.render.html.THtmlOutputTextRenderer;
publicclassHogeOutputRendererextendsTHtmlOutputTextRenderer{
  publicHogeOutputRenderer(){
    System.out.println("hogehoge");
  }
  protectedvoidencodeHtmlOutputTextEnd(FacesContextarg0,
      HtmlOutputTextarg1)throwsIOException{
    System.out.println("encodeHtmlOutputTextEnd");
    super.encodeHtmlOutputTextEnd(arg0,arg1);
  }
}

?

?

 AddPage.java

packagecom.teeda.web.add;
importorg.seasar.teeda.extension.annotation.validator.GreaterThanConstant;
publicclassAddPage{
  @GreaterThanConstant
  privateintarg1;
  @GreaterThanConstant
  privateintarg2;
  privateintresult;
  publicvoidinitialize(){
    System.out.println("addinit");
  }
  publicvoidprerender(){
    System.out.println("addprerender");
  }
  publicintgetArg1(){
    returnarg1;
  }
  publicvoidsetArg1(intarg1){
    this.arg1=arg1;
  }
  publicintgetArg2(){
    returnarg2;
  }
  publicvoidsetArg2(intarg2){
    this.arg2=arg2;
  }
  publicintgetResult(){
    returnresult;
  }
  publicvoidsetResult(intresult){
    this.result=result;
  }
  publicStringdoOnceCalculate(){
    result=arg1+arg2;
    returnnull;
  }
  publicbooleanisArg1Disabled(){
    returnfalse;
  }
}

  HelloPage.java

packagecom.teeda.web.hello;
publicclassHelloPage{
  publicStringhoge="Teeda";
  publicClass<?>initialize(){
    returnnull;
  }
  publicClass<?>prerender(){
    returnnull;
  }
  publicStringgetLayout(){
    returnnull;
  }
}

?

?

 app_aop.dicon

<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEcomponentsPUBLIC"-//SEASAR//DTDS2Container2.4//EN"
  "http://www.seasar.org/dtd/components24.dtd">
<componentsnamespace="app_aop">
  <includepath="convention.dicon"/>
  <componentname="actionSupportInterceptor"class="org.seasar.teeda.extension.interceptor.ActionSupportInterceptor"/>
</components>

  app.dicon

<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEcomponentsPUBLIC"-//SEASAR//DTDS2Container2.4//EN"
  "http://www.seasar.org/dtd/components24.dtd">
<components>
  <includepath="convention.dicon"/>
  <includepath="aop.dicon"/>
  <includepath="app_aop.dicon"/>
  <includepath="teedaExtension.dicon"/>
</components>

  appMessages_ja.properties与appMessages.properties暂为空。

  convention.dicon

<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEcomponentsPUBLIC"-//SEASAR//DTDS2Container2.4//EN" 
  "http://www.seasar.org/dtd/components24.dtd">
<components>
  <compon