Category: ‘Seasar2’

eclipse のコンソールで日本語の文字化け

2014年3月1日 Posted by PURGE

eclipse インストールフォルダにある eclipse.ini に下記を記述する。

-Dfile.encoding=UTF-8

解決。

SAStrutsでformクラスが見つからないエラー

2013年7月25日 Posted by PURGE

コンポーネント(class com.whoocus.app.form.xxxxForm)が見つかりません

こんな時は、下記をそれぞれのdiconファイルに追記してやる。

creator.dicon

<component class="org.seasar.struts.creator.FormCreator"/>

customizer.dicon

<component name="formCustomizer" class="org.seasar.framework.container.customizer.CustomizerChain"/>

毎回ハマる。(-_-;)

Seasar2 SAStruts でのjspファイルの配置場所

2013年7月8日 Posted by PURGE

SAStrutsでの、jspファイルの配置場所に迷った。
基本、ActionからフォワードされるJSPファイルはWEB-INF以下に配置するべきである。
下記がそれぞれの設定。

web.xml

  <context-param>
        <param-name>sastruts.VIEW_PREFIX</param-name>
        <param-value>/WEB-INF/view</param-value>
    </context-param>

    <!-- commonディレクトリも/WEB-INF/view 以下に移動した場合 -->
    <jsp-config>
    	<jsp-property-group>
    		<url-pattern>*.jsp</url-pattern>
    		<el-ignored>false</el-ignored>
    		<page-encoding>UTF-8</page-encoding>
    		<scripting-invalid>false</scripting-invalid>
    		<include-prelude>/WEB-INF/view/common/common.jsp</include-prelude>
    	</jsp-property-group>
    </jsp-config>

IndexAction.java

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

WEB-INF/view/index/index.jsp

<html>
<head>index.jsp</head>
<body>
Hello.
</body>
</html>