[Seasar-user:21510] バリデート処理でインターセプターが後に実行されてしまいます。

清水修一 [E-MAIL ADDRESS DELETED]
2012年 12月 4日 (火) 11:01:29 JST


初めまして清水です。

SAStrutsでwebプログラム開発を行なっております。
インターセプターパッケージとヘルパーパッケージを作成して
マップ取得を行いプルダウンの項目に反映させる事は出来たのですが、
フォームにバリデート設定を
行うとエラーが表示されてしまいうまく行きません。
何か解決方法はないでしょうか?

下記詳細となります。

Doltengプロジェクト作成時詳細
-------------------------------------
アプリケーションタイプ:webアプリケーション

JREコンテナー
プロジェクト固有のJREを使用 jre1.5
表示:SAstruts
永続化:S2JDBC
サーバー管理:Sysdeo Tomcatプラグイン

エラーコード
--------------------------------------
HTTPステータス 500 -

メッセージ

説明 The server encountered an internal error () that prevented it from
fulfilling this request.

例外

org.apache.jasper.JasperException: javax.servlet.ServletException:
javax.servlet.jsp.JspException: どのスコープにもBean JspHelper がありません
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:86)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.seasar.struts.action.S2RequestProcessor.doForward(S2RequestProcessor.java:306)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
org.seasar.struts.action.S2RequestProcessor.process(S2RequestProcessor.java:134)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.seasar.extension.filter.RequestDumpFilter.doFilter(RequestDumpFilter.java:127)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:86)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.seasar.struts.filter.RoutingFilter.forward(RoutingFilter.java:219)
org.seasar.struts.filter.RoutingFilter.doFilter(RoutingFilter.java:152)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:99)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.seasar.extension.filter.EncodingFilter.doFilter(EncodingFilter.java:69)
原因

javax.servlet.ServletException: javax.servlet.jsp.JspException:
どのスコープにもBean JspHelper がありません
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.WEB_002dINF.view.index_jsp._jspService(index_jsp.java:111)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:86)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.seasar.struts.action.S2RequestProcessor.doForward(S2RequestProcessor.java:306)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
org.seasar.struts.action.S2RequestProcessor.process(S2RequestProcessor.java:134)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.seasar.extension.filter.RequestDumpFilter.doFilter(RequestDumpFilter.java:127)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:86)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.seasar.struts.filter.RoutingFilter.forward(RoutingFilter.java:219)
org.seasar.struts.filter.RoutingFilter.doFilter(RoutingFilter.java:152)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:99)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.seasar.extension.filter.EncodingFilter.doFilter(EncodingFilter.java:69)
原因

javax.servlet.jsp.JspException: どのスコープにもBean JspHelper がありません
org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
org.apache.struts.taglib.html.OptionsCollectionTag.doStartTag(OptionsCollectionTag.java:173)
org.apache.jsp.WEB_002dINF.view.index_jsp._jspx_meth_html_005foptionsCollection_005f0(index_jsp.java:240)
org.apache.jsp.WEB_002dINF.view.index_jsp._jspx_meth_html_005fselect_005f0(index_jsp.java:204)
org.apache.jsp.WEB_002dINF.view.index_jsp._jspx_meth_s_005fform_005f0(index_jsp.java:156)
org.apache.jsp.WEB_002dINF.view.index_jsp._jspService(index_jsp.java:99)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:86)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.seasar.struts.action.S2RequestProcessor.doForward(S2RequestProcessor.java:306)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
org.seasar.struts.action.S2RequestProcessor.process(S2RequestProcessor.java:134)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.seasar.extension.filter.RequestDumpFilter.doFilter(RequestDumpFilter.java:127)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:86)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.seasar.struts.filter.RoutingFilter.forward(RoutingFilter.java:219)
org.seasar.struts.filter.RoutingFilter.doFilter(RoutingFilter.java:152)
org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:99)
org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
org.seasar.extension.filter.EncodingFilter.doFilter(EncodingFilter.java:69)


ファイル名:InitInterceptor.java
-------------------------------------

import javax.annotation.Resource;

package err.interceptor;

public class InitInterceptor extends AbstractInterceptor  {

    @Resource
    public JspHelper jspHelper;

    private static final long serialVersionUID = 1L;

    public Object invoke(MethodInvocation invocation) throws Throwable {

    this.setupRequest();

    return invocation.proceed();

    }

    protected void setupRequest() {
    request.setAttribute("JspHelper", jspHelper);
    }
    }

ファイル名:JspHelper.java
-------------------------------------
package err.helper;


public class JspHelper {


    /**
     * 各項目プルダウン選択肢マップを取得します。
     * @return
     */
public LinkedHashMap<String, Integer> getCarsizeName(){
LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>();
map.put("テスト1", new Integer(1));
map.put("テスト2", new Integer(1));
map.put("テスト3", new Integer(1));

return map;
}

}



ファイル名:ValidatorForm.java
-------------------------------------

package err.form;


import org.apache.struts.upload.FormFile;
import org.seasar.framework.container.annotation.tiger.Binding;
import org.seasar.framework.container.annotation.tiger.BindingType;
import org.seasar.struts.annotation.Maxlength;
import org.seasar.struts.annotation.Required;
import org.seasar.struts.annotation.IntegerType;


public class ValidatorForm {

@Required
public String TestText;

public String bodySizeId = "";


}


ファイル名:IndexAction.java
-------------------------------------
package err.action;

import java.util.List;
import javax.annotation.Resource;
import org.seasar.struts.annotation.ActionForm;
import org.seasar.struts.annotation.Execute;
import err.form.ValidatorForm;



public class IndexAction {


@ActionForm
@Resource
protected ValidatorForm validatorForm;


    @Execute(validator = false)
public String index() {
    return "index.jsp";
}


    @Execute(input = "index.jsp")
    public String insert() {
        return "index.jsp";
    }
}

ファイル名:index.jsp
-------------------------------------
<p>登録</p>

<html:errors />
<s:form enctype="multipart/form-data">
<table>
<tr>
<td class="t_line01">
サイズ
</td>
<td class="t_line02">
<html:select property="bodySizeId"  errorStyleClass="err"  >
<html:optionsCollection name="JspHelper" property="carsizeName" label="key"
value="value"/>
</html:select>
</td>
<td>
<html:text property="TestText"></html:text>
</td>
</tr>
</table>
<input type="submit" name="insert" value="サブミット"/>
</s:form>
</body>

ファイル名:creator.dicon
-------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container 2.4//EN"
"http://www.seasar.org/dtd/components24.dtd">
<components>
<include path="convention.dicon"/>
<include path="customizer.dicon"/>
<component class="org.seasar.framework.container.creator.ActionCreator"/>
<component class="org.seasar.struts.creator.FormCreator"/>
<component class="org.seasar.framework.container.creator.ServiceCreator"/>
<component class="org.seasar.framework.container.creator.DtoCreator"/>
<component class="org.seasar.framework.container.creator.HelperCreator"/>
<component
class="org.seasar.framework.container.creator.InterceptorCreator"/>
<component class="org.seasar.framework.container.creator.DaoCreator"/>
</components>

ファイル名:customizer.dicon
-------------------------------------
<components>
  <include path="default-customizer.dicon"/>
  <component name="formCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain"/>
  <component name="actionCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addAspectCustomizer">
        <arg>"initInterceptor"</arg>
        <arg>true</arg>
          </initMethod>
            <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>
    <initMethod name="addCustomizer">
      <arg>
        <component
class="org.seasar.framework.container.customizer.TxAttributeCustomizer"/>
      </arg>
    </initMethod>
    <initMethod name="addCustomizer">
      <arg>
        <component class="org.seasar.struts.customizer.ActionCustomizer"/>
      </arg>
    </initMethod>
  </component>
  <component name="serviceCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>
    <initMethod name="addCustomizer">
      <arg>
        <component
class="org.seasar.framework.container.customizer.TxAttributeCustomizer"/>
      </arg>
    </initMethod>
  </component>
</components>
-------------- next part --------------
HTMLの添付ファイルを保管しました...
URL: <http://ml.seasar.org/archives/seasar-user/attachments/20121204/d06206e5/attachment.html>


Seasar-user メーリングリストの案内