beanタグのwriteの使い方。

タグの定義は1.2以前と1.3では異なる。

1.3
 <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

1.2以前
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>

int型のプロパティを出力する場合は、formatで書式設定しないと

以下のエラーが発生
org.apache.jasper.JasperException: An exception occurred processing JSP
java.lang.NullPointerException: Module 'null' not found.
対処前
<bean:write name="testBean" scope="request" property="testInt" />
対処済み
<bean:write name="testBean" scope="request" property="testInt" format="#########"/>

formatを指定しないと、intのまま出力しようとして、出力時のstringとの

型違いでのエラーと思う。

ちなみに対応するbeanのgetterは

public int getTestInt(){

int testInt = 3;

return testInt ;

}