This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-staging
in repository https://gitbox.apache.org/repos/asf/struts-site.git


The following commit(s) were added to refs/heads/asf-staging by this push:
     new 36edbabb5 Updates stage by Jenkins
36edbabb5 is described below

commit 36edbabb5c2e4a026a71052aa786a36fbd9e0ba0
Author: jenkins <bui...@apache.org>
AuthorDate: Thu May 25 13:37:38 2023 +0000

    Updates stage by Jenkins
---
 content/tag-developers/ognl.html | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/content/tag-developers/ognl.html b/content/tag-developers/ognl.html
index 27f333320..ef02d29c8 100644
--- a/content/tag-developers/ognl.html
+++ b/content/tag-developers/ognl.html
@@ -239,11 +239,27 @@ selects “name2” as the default value:</p>
 
 <p>To obtain a subset of just male relatives from the object person:</p>
 
-<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code>&lt;s:iterator value="person.relatives.{? #this.gender 
== 'male'}"&gt;
+<div class="language-jsp highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;s:iterator </span><span 
class="na">value=</span><span class="s">"person.relatives.{? #this.gender == 
'male'}"</span><span class="nt">&gt;</span>
   ...
-&lt;/s:iterator&gt;
+<span class="nt">&lt;/s:iterator&gt;</span>
 </code></pre></div></div>
 
+<p>You can also use projection to extract just a given property out of a 
bean:</p>
+
+<div class="language-jsp highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;s:iterator </span><span 
class="na">value=</span><span class="s">"persons.{firstName}"</span><span 
class="nt">&gt;</span>
+  <span class="nt">&lt;s:property/&gt;</span>
+<span class="nt">&lt;/s:iterator&gt;</span>
+</code></pre></div></div>
+
+<p>it’s the same as using more expressive version:</p>
+
+<div class="language-jsp highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;s:iterator </span><span 
class="na">value=</span><span class="s">"persons"</span><span class="na"> 
var=</span><span class="s">"person"</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;s:property </span><span class="na">value=</span><span 
class="s">"person.firstName"</span><span class="nt">/&gt;</span>
+<span class="nt">&lt;/s:iterator&gt;</span>
+</code></pre></div></div>
+
+<p>More details can can be found in OGNL documentation about <a 
href="https://ognl.orphan.software/language-guide#projecting-across-collections";>projection</a>.</p>
+
   </section>
 </article>
 

Reply via email to