[Seasar-user:5685] Re: [S2Struts]インターフェイスを使用しないActionの作成方法
Katsuhiko Nagashima
[E-MAIL ADDRESS DELETED]
2007年 1月 8日 (月) 23:38:49 JST
永島です。
返答が遅くなりすみません。
インターフェースを使わないActionに1つのメソッドのみを定義した場合、
equals等のメソッドやPropertyのgetter/setterメソッドもActionのメソッドと判断していたため、
正常に呼び出すことができていませんでした。
インターフェースを利用しないActionクラスの場合、
do、go、executeからはじまるメソッドのみをActionメソッドとして処理し
1つのメソッドしか定義していない場合、
Action実行時にその該当メソッドを呼び出すように修正しました。
ご指摘ありがとうございます。
06/12/29 に [E-MAIL ADDRESS DELETED]<[E-MAIL ADDRESS DELETED]> さんは書きました:
> 岩崎と申します。
>
> 以下のスナップショットを使用して、S2Struts1.3.0を試しています。
> https://www.seasar.org/svn/s2struts/tags/temp/2006-12-12/S2StrutsExampleEmployee-V1.3.0-beta-3-SNAPSHOT.zip
>
> Seasar2.4から、Actionはクラスで実装することを推奨していると言う事で、
> インターフェースを使わないActionを作成することを試みていますが、
> 上手くいきません。
>
> 具体的に実施した内容ですが、
>
> 01.
> org.seasar.struts.examples.employee.web.logonパッケージに
> Test01Actionというクラスを作成
>
> ----------↓Test01Action.java
> package org.seasar.struts.examples.employee.web.logon;
>
> public class Test01Action {
> String doTest01() {
> return "success";
> }
> }
> ----------↑Test01Action.java
>
> 02.
> /logon/logon.htmlに/logon/test01.doリンクを作成し、実行
>
> 03.
> error.htmlに遷移。
> Tomcatのコンソールには以下のようなログが出力されました。
>
> ----------↓
> DEBUG 2006-12-29 00:17:28,785 [http-8080-Processor23] BEGIN org.seasar.struts.hotdeploy.ReloadFindActionConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:28,785 [http-8080-Processor23] Initializing module path '' configuration from '/WEB-INF/struts-config.xml'
> DEBUG 2006-12-29 00:17:28,832 [http-8080-Processor23] BEGIN org.seasar.struts.lessconfig.hotdeploy.OndemandFindActionConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:28,879 [http-8080-Processor23] クラス(org.seasar.struts.examples.employee.web.logon.Test01Action[logon_test01Action])のコンポーネント定義を登録します
> DEBUG 2006-12-29 00:17:28,879 [http-8080-Processor23] BEGIN org.seasar.struts.hotdeploy.ReloadFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:28,879 [http-8080-Processor23] Initializing module path '' configuration from '/WEB-INF/struts-config.xml'
> DEBUG 2006-12-29 00:17:28,910 [http-8080-Processor23] BEGIN org.seasar.struts.lessconfig.hotdeploy.OndemandFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:28,910 [http-8080-Processor23] END org.seasar.struts.lessconfig.hotdeploy.OndemandFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : null
> DEBUG 2006-12-29 00:17:28,910 [http-8080-Processor23] END org.seasar.struts.hotdeploy.ReloadFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : null
> DEBUG 2006-12-29 00:17:28,910 [http-8080-Processor23] BEGIN org.seasar.struts.hotdeploy.ReloadFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:28,910 [http-8080-Processor23] Initializing module path '' configuration from '/WEB-INF/struts-config.xml'
> DEBUG 2006-12-29 00:17:28,988 [http-8080-Processor23] BEGIN org.seasar.struts.lessconfig.hotdeploy.OndemandFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:28,988 [http-8080-Processor23] END org.seasar.struts.lessconfig.hotdeploy.OndemandFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : null
> DEBUG 2006-12-29 00:17:28,988 [http-8080-Processor23] END org.seasar.struts.hotdeploy.ReloadFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : null
> DEBUG 2006-12-29 00:17:28,988 [http-8080-Processor23] BEGIN org.seasar.struts.hotdeploy.ReloadFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:28,988 [http-8080-Processor23] Initializing module path '' configuration from '/WEB-INF/struts-config.xml'
> DEBUG 2006-12-29 00:17:29,004 [http-8080-Processor23] BEGIN org.seasar.struts.lessconfig.hotdeploy.OndemandFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:29,004 [http-8080-Processor23] END org.seasar.struts.lessconfig.hotdeploy.OndemandFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : null
> DEBUG 2006-12-29 00:17:29,004 [http-8080-Processor23] END org.seasar.struts.hotdeploy.ReloadFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : null
> DEBUG 2006-12-29 00:17:29,019 [http-8080-Processor23] auto create ActionConfig[cancellable=falsepath=/logon/test01validate=true,scope=request,type=org.seasar.struts.examples.employee.web.logon.Test01Action
> DEBUG 2006-12-29 00:17:29,019 [http-8080-Processor23] auto create ForwardConfig[name=success,path=/pages/logon/test01.html,redirect=false,module=null,extends=null,catalog=null,command=null]
> DEBUG 2006-12-29 00:17:29,019 [http-8080-Processor23] END org.seasar.struts.lessconfig.hotdeploy.OndemandFindActionConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : ActionConfig[cancellable=falsepath=/logon/test01validate=true,scope=request,type=org.seasar.struts.examples.employee.web.logon.Test01Action
> DEBUG 2006-12-29 00:17:29,019 [http-8080-Processor23] END org.seasar.struts.hotdeploy.ReloadFindActionConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : ActionConfig[cancellable=falsepath=/logon/test01validate=true,scope=request,type=org.seasar.struts.examples.employee.web.logon.Test01Action
> DEBUG 2006-12-29 00:17:29,019 [http-8080-Processor23] BEGIN org.seasar.struts.hotdeploy.ReloadFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:29,019 [http-8080-Processor23] Initializing module path '' configuration from '/WEB-INF/struts-config.xml'
> DEBUG 2006-12-29 00:17:29,051 [http-8080-Processor23] BEGIN org.seasar.struts.lessconfig.hotdeploy.OndemandFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED])
> DEBUG 2006-12-29 00:17:29,051 [http-8080-Processor23] END org.seasar.struts.lessconfig.hotdeploy.OndemandFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : null
> DEBUG 2006-12-29 00:17:29,051 [http-8080-Processor23] END org.seasar.struts.hotdeploy.ReloadFindFormBeanConfigInterceptor#invoke([E-MAIL ADDRESS DELETED]) : null
> ------ req-path: /pages/error.html
> att: javax.servlet.forward.request_uri = /s2struts-example-employee/logon/test01.do
> att: javax.servlet.forward.context_path = /s2struts-example-employee
> att: javax.servlet.forward.servlet_path = /logon/test01.do
> att: org.seasar.framework.container.hotdeploy.HotdeployFilter = [E-MAIL ADDRESS DELETED]
> att: org.apache.struts.action.MESSAGE = [E-MAIL ADDRESS DELETED]
> att: org.seasar.struts.hotdeploy.CacheFindActionConfigInterceptor.REQUEST_KEY = {/logon/test01=ActionConfig[cancellable=falsepath=/logon/test01validate=true,scope=request,type=org.seasar.struts.examples.employee.web.logon.Test01Action}
> att: org.apache.struts.action.ERROR = {errors.global.runtime=[errors.global.runtime[Action can not be called.]]}
> att: logon_test01Action = org.seasar.struts.examples.employee.web.logon.Test01Action$$EnhancedByS2AOP$$[E-MAIL ADDRESS DELETED]
> att: org.apache.struts.action.EXCEPTION = org.seasar.struts.pojo.exception.NotCalledActionRuntimeException: Action can not be called.
> att: org.seasar.struts.page.CLEAR_MARK = true
> att: org.apache.struts.action.mapping.instance = ActionConfig[cancellable=falsepath=/logon/test01validate=true,scope=request,type=org.seasar.struts.examples.employee.web.logon.Test01Action
> att: org.seasar.struts.hotdeploy.CacheFindFormBeanConfigInterceptor.REQUEST_KEY = {logon_test01Form=null, logon_test01=null, logon_test01Dto=null, null=null}
> att: org.apache.struts.action.MODULE = org.seasar.struts.hotdeploy.ModuleConfigWrapper$$EnhancedByS2AOP$$[E-MAIL ADDRESS DELETED]
> ses: manage_employeeSearchForm = org.seasar.struts.pojo.processor.ProcessPojoFormInterceptor$[E-MAIL ADDRESS DELETED]
> ses: s2strutsContext = [E-MAIL ADDRESS DELETED]
> ses: org.apache.struts.action.LOCALE = ja
> 2006-12-29 00:17:29,113 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,113 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,113 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,113 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,129 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,129 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,129 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,129 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,129 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,129 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,144 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,144 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,160 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,160 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,160 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,160 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,176 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,176 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,176 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,176 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,191 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,191 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,191 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,191 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,191 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,191 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> 2006-12-29 00:17:29,207 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja.properties Not Found.
> 2006-12-29 00:17:29,207 [http-8080-Processor23] WARN org.apache.struts.util.PropertyMessageResources - Resource application_ja_JP.properties Not Found.
> ----------↑
>
> 04.
> Actionをインターフェースと実装クラスに分離したところ、
> 上手くいきました。
> (logon/test02.htmlに遷移)
> ----------↓Test02Action.java
> package org.seasar.struts.examples.employee.web.logon;
>
> public interface Test02Action {
> public String doTest02();
> }
> ----------↑Test02Action.java
>
> ----------↓Test02ActionImpl.java
> package org.seasar.struts.examples.employee.web.logon.impl;
> import org.seasar.struts.examples.employee.web.logon.Test02Action;
>
> public class Test02ActionImpl implements Test02Action {
> public String doTest02() {
> return "success";
> }
> }
> ----------↑Test02ActionImpl.java
>
> 何か設定が必要なのでしょうか?
> よろしくお願いいたします。
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
--
Katsuhiko Nagashima
Seasar-user メーリングリストの案内