dポイントプレゼントキャンペーン実施中!

今自分独自でStrutsのシステムを作っています。logic:iterateでは動くのですが、なぜかforEachをつかった場合動きません。
環境JAVA1.8
Struts1.3.10
tomcat8
Eclipseです
すみませんが、プログラムを貼らせてもらいます。
JSPの部分です
<c:forEach var="syousai" items="${ActionForm.syousaiList}">
<tr id = "body">
<td><html:text name="syousai" property="kyuyo" indexed="true"/></td>
<td><html:text name="syousai" property="zatu" indexed="true"/></td>
<td><html:text name="syousai" property="zei" indexed="true"/></td>
<td><html:text name="syousai" property="syotoku" indexed="true"/></td>
<td><html:text name="syousai" property="jyumin" indexed="true"/></td>
<td><html:text name="syousai" property="goukei" indexed="true"/></td>
<td><html:checkbox name="syousai" property="syocheck" indexed="true"/></td>
</tr>
</c:forEach>
Formの部分です。
  public List<SyousaiForm> getSyousaiList() {
return syousaiList;
  }

  public void setSyousaiList(List<SyousaiForm> syousaiList) {
    this.syousaiList = syousaiList;
  }

public SyousaiForm getSyousai(int cnt) {
while (this.syousaiList.size() <= cnt) {
this.syousaiList.add(new SyousaiForm());
}
return this.syousaiList.get(cnt);
}
これがどうしても動きません。すみませんが、教えていただけないでしょうか。

よろしくお願いいたします。

質問者からの補足コメント

  • つらい・・・

    すみません。どうしてもforEachで動かしたいのですが、どのようにすればよろしいでしょうか。
    ご回答よろしくお願いします。

    No.1の回答に寄せられた補足コメントです。 補足日時:2016/09/15 10:28

A 回答 (2件)

>どうしてもforEachで動かしたいのですが



strutsタグは連携するように出来てますが、JSTLタグとは
密に連携出来ないので無理です。

なぜforEachに拘るのかわかりませんが、JSPなのですから
Javaでループ変数を作るとかすれば簡単ですよね?

それともタブじゃなきゃいけない縛りとかが有るのでしょうか?
    • good
    • 1
この回答へのお礼

ありがとうございます。

お礼日時:2016/09/21 12:53

<html:text> が indexed属性=true のとき、リクエスト名を作るのに


インデックスが必要ですが、インデックスを作るのは <logic:iterate> です。
この回答への補足あり
    • good
    • 1

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!