0

列の増分カウントを設定するために使用できる jxls でローカル変数を定義できますか。

例:以下を検討してください

<jx:forEach items="${myList}" var="myVar">
-- i need to define a local integer variable here which will have an initial value as 0
-- and i will increment it and display in the output xls's first column
</jx:forEach>

基本的に私の要件は、jxls コードで何らかのローカル変数宣言を行い、それをインクリメントして xml に表示することです。

他の代替案は大歓迎です。

よろしく、ラフル

4

2 に答える 2

5

jx :forEach タグは、反復ごとに Bean コンテキストに渡されるループ ステータス オブジェクトの名前を定義するvarStatus属性をサポートします。ループ ステータス オブジェクトは、繰り返されるコレクション内の現在の項目のインデックスを識別する単一の「 index 」プロパティを持つ LoopStatus クラスのインスタンスです。

<jx:forEach items="${employees}" var="employee" varStatus="status">
  | ${status.index} | ${employee.name} | ${employee.payment} | ${employee.bonus}
</jx:forEach>
于 2012-04-20T03:22:54.553 に答える
0

考え出した....<jx:out expr="hssfRow.getRowNum()" />番号付けを表示したい列で使用できます。上記のコードを<jx:forEach items="${myList}" var="myVar">タグ内に保持できます

于 2012-04-12T14:39:40.663 に答える