Jsp-jstl-core-foreach-tag
提供:Dev Guides
JSTL-コア<c:forEach>、<c:forTokens>タグ
これらのタグは、スクリプトレットを介してJavaの* for、while、または *do-while ループを埋め込むための優れた代替手段として存在します。 <c:forEach> タグは、オブジェクトのコレクションを反復処理するため、一般的に使用されるタグです。 <c:forTokens> タグは、文字列をトークンに分割し、各トークンを反復処理するために使用されます。
属性
Attribute | Description | Required | Default |
---|---|---|---|
items | Information to loop over | No | None |
begin | Element to start with (0 = first item, 1 = second item, …) | No | 0 |
end | Element to end with (0 = first item, 1 = second item, …) | No | Last element |
step | Process every step items | No | 1 |
var | Name of the variable to expose the current item | No | None |
varStatus | Name of the variable to expose the loop status | No | None |
Attribute | Description | Required | Default |
---|---|---|---|
delims | Characters to use as delimiters | Yes | None |
<c:forEach>の例
上記のコードは、次の結果を生成します-
<c:forTokens>の例
上記のコードは、次の結果を生成します-