This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/asf-site by this push: new e0eb145c7 Automatic Site Publish by Buildbot e0eb145c7 is described below commit e0eb145c75945aac1409ea37f5f38eb264b01d6e Author: buildbot <us...@infra.apache.org> AuthorDate: Sun Jan 28 08:50:13 2024 +0000 Automatic Site Publish by Buildbot --- output/tag-developers/iterator-tag.html | 35 ++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/output/tag-developers/iterator-tag.html b/output/tag-developers/iterator-tag.html index b9dbf0de6..cba519d83 100644 --- a/output/tag-developers/iterator-tag.html +++ b/output/tag-developers/iterator-tag.html @@ -150,7 +150,14 @@ <a href="tag-reference.html" title="back to Tag Reference"><< back to Tag Reference</a> - <h1 id="iterator">iterator</h1> + <h1 class="no_toc" id="iterator">iterator</h1> + +<ul id="markdown-toc"> + <li><a href="#description" id="markdown-toc-description">Description</a></li> + <li><a href="#attributes" id="markdown-toc-attributes">Attributes</a></li> + <li><a href="#conversion" id="markdown-toc-conversion">Conversion</a></li> + <li><a href="#examples" id="markdown-toc-examples">Examples</a></li> +</ul> <p>Please make sure you have read the <a href="tag-syntax">Tag Syntax</a> document and understand how tag attribute syntax works.</p> @@ -241,6 +248,28 @@ The <code class="language-plaintext highlighter-rouge">begin</code>, <code class </tr> </table> +<h2 id="conversion">Conversion</h2> + +<p>Values generated by the tag are subject of internal conversion mechanism. It means when generating ordinary numbers +and then using them with <code class="language-plaintext highlighter-rouge"><s:property/></code>, the Integers will be converted to Strings using the current locale. +This can impact how the numbers are presented. To avoid conversion you can use the <code class="language-plaintext highlighter-rouge">status</code> object and its <code class="language-plaintext highlighter-rouge">countStr</code> +and <code class="language-plaintext highlighter-rouge">indexStr</code> which are a String representation of the numbers. The following example demonstrates the case when +using <code class="language-plaintext highlighter-rouge">fa_IR</code> locale:</p> + +<div class="language-jsp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><s:iterator </span><span class="na">begin=</span><span class="s">"1"</span><span class="na"> end=</span><span class="s">"3"</span><span class="na"> status=</span><span class="s">"status"</span><span class="nt">></span> + <span class="nt"><s:property/></span> + <span class="nt"><s:textfield </span><span class="na">id=</span><span class="s">"text_%{#status.countStr}"</span><span class="na"> name=</span><span class="s">"test[%{#status.indexStr}]"</span><span class="nt">/></span> +<span class="nt"></s:iterator></span> +</code></pre></div></div> + +<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code>۰ +<span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">name=</span><span class="s">"test[0]"</span> <span class="na">value=</span><span class="s">""</span> <span class="na">id=</span><span class="s">"text_1"</span><span class="nt">></span> +۱ +<span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">name=</span><span class="s">"test[1]"</span> <span class="na">value=</span><span class="s">""</span> <span class="na">id=</span><span class="s">"text_2"</span><span class="nt">></span> +۲ +<span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">name=</span><span class="s">"test[2]"</span> <span class="na">value=</span><span class="s">""</span> <span class="na">id=</span><span class="s">"text_3"</span><span class="nt">></span> +</code></pre></div></div> + <h2 id="examples">Examples</h2> <p>The following example retrieves the value of the getDays() method of the current object on the value stack and uses @@ -251,8 +280,8 @@ it to iterate over. The <code class="language-plaintext highlighter-rouge"><s <span class="nt"></s:iterator></span> </code></pre></div></div> -<p>The following example uses a {@link Bean} tag and places it into the ActionContext. The iterator tag will retrieve that -object from the <code class="language-plaintext highlighter-rouge">ActionContext</code> and then calls its <code class="language-plaintext highlighter-rouge">getDays()</code> method as above. The status attribute is also used +<p>The following example uses a <a href="bean-tag">Bean</a> tag and places it into the <code class="language-plaintext highlighter-rouge">ActionContext</code>. The iterator tag will retrieve +that object from the <code class="language-plaintext highlighter-rouge">ActionContext</code> and then calls its <code class="language-plaintext highlighter-rouge">getDays()</code> method as above. The status attribute is also used to create an <code class="language-plaintext highlighter-rouge">IteratorStatus</code> object, which in this example, its <code class="language-plaintext highlighter-rouge">odd()</code> method is used to alternate row colours:</p> <div class="language-jsp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><s:bean </span><span class="na">name=</span><span class="s">"org.apache.struts2.example.IteratorExample"</span><span class="na"> var=</span><span class="s">"it"</span><span class="nt">></span>