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 ae5d466a4 Automatic Site Publish by Buildbot
ae5d466a4 is described below
commit ae5d466a45138dd2af72be508bc8e0db3ba1c6c4
Author: buildbot <[email protected]>
AuthorDate: Tue Oct 31 09:10:04 2023 +0000
Automatic Site Publish by Buildbot
---
output/tag-developers/include-tag.html | 45 ++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 5 deletions(-)
diff --git a/output/tag-developers/include-tag.html
b/output/tag-developers/include-tag.html
index b93c3120b..ed47efebe 100644
--- a/output/tag-developers/include-tag.html
+++ b/output/tag-developers/include-tag.html
@@ -163,10 +163,28 @@ through the <code class="language-plaintext
highlighter-rouge"><s:property...
via the HttpServletRequest object or from a JSP page via a scriptlet.</p>
</blockquote>
-<p><strong>How To access parameters</strong></p>
+<h3 id="how-to-access-parameters">How to access parameters</h3>
-<p>Parameters are passed as request parameters, so use the <code
class="language-plaintext highlighter-rouge">${param.ParamName}</code> notation
to access them. Do not use
-the <strong>property</strong> tag to access parameters in included files.</p>
+<p>Parameters are passed as request parameters, so use the <code
class="language-plaintext highlighter-rouge">${param.paramName}</code> notation
to access them. Do not use
+the <code class="language-plaintext
highlighter-rouge"><s:property/></code> tag to access parameters in
included files.</p>
+
+<p>Below it’s an example how you can access parameters passed into the
included page:</p>
+
+<p>with scope:</p>
+<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><s:set var="innerName"
scope="page">${param.paramName}</s:set>
+<s:property value="#attr.innerName"/>
+</code></pre></div></div>
+
+<p>with no scope:</p>
+<div class="language-jsp highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><s:set </span><span
class="na">var=</span><span class="s">"innerName"</span><span
class="nt">></span>${param.paramName}<span class="nt"></s:set></span>
+<span class="nt"><s:property </span><span class="na">value=</span><span
class="s">"innerName"</span><span class="nt">/></span>
+<span class="nt"><s:property </span><span class="na">value=</span><span
class="s">"#attr.innerName"</span><span class="nt">/></span>
+<span class="nt"><s:property </span><span class="na">value=</span><span
class="s">"#innerName"</span><span class="nt">/></span>
+</code></pre></div></div>
+
+<blockquote>
+ <p><strong>Note</strong>: You can access such params without using JSTL,
just use <code class="language-plaintext
highlighter-rouge">${param.paramName}</code> notation.</p>
+</blockquote>
<h2 id="attributes">Attributes</h2>
@@ -220,7 +238,7 @@ the <strong>property</strong> tag to access parameters in
included files.</p>
<span class="nt"></s:include></span>
</code></pre></div></div>
-<p>do an include to myJsp.jsp page with parameters <code
class="language-plaintext highlighter-rouge">param1=value1</code> and <code
class="language-plaintext highlighter-rouge">param2=value2</code></p>
+<p>do an include to <code class="language-plaintext
highlighter-rouge">myJsp.jsp</code> page with parameters <code
class="language-plaintext highlighter-rouge">param1=value1</code> and <code
class="language-plaintext highlighter-rouge">param2=value2</code></p>
<p><strong>Example 3</strong></p>
@@ -230,7 +248,24 @@ the <strong>property</strong> tag to access parameters in
included files.</p>
<span class="nt"></s:include></span>
</code></pre></div></div>
-<p>do an include to myJsp.jsp page with parameters <code
class="language-plaintext highlighter-rouge">param1=value1</code> and <code
class="language-plaintext highlighter-rouge">param2=value2</code></p>
+<p>do an include to <code class="language-plaintext
highlighter-rouge">myJsp.jsp</code> page with parameters <code
class="language-plaintext highlighter-rouge">param1=value1</code> and <code
class="language-plaintext highlighter-rouge">param2=value2</code></p>
+
+<p><strong>Example 4</strong></p>
+
+<p>accessing passed parameters in the included page</p>
+
+<p>with scope:</p>
+<div class="language-jsp highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><s:set </span><span
class="na">var=</span><span class="s">"param1"</span><span class="na">
scope=</span><span class="s">"page"</span><span
class="nt">></span>${param.param1}<span class="nt"></s:set></span>
+<span class="nt"><s:property </span><span class="na">value=</span><span
class="s">"#attr.param1"</span><span class="nt">/></span>
+</code></pre></div></div>
+
+<p>with no scope:</p>
+<div class="language-jsp highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><s:set </span><span
class="na">var=</span><span class="s">"param2"</span><span
class="nt">></span>${param.param2}<span class="nt"></s:set></span>
+<span class="nt"><s:property </span><span class="na">value=</span><span
class="s">"param2"</span><span class="nt">/></span>
+
+<span class="nt"><s:property </span><span class="na">value=</span><span
class="s">"#attr.param2"</span><span class="nt">/></span>
+<span class="nt"><s:property </span><span class="na">value=</span><span
class="s">"#param2"</span><span class="nt">/></span>
+</code></pre></div></div>
</section>
</article>