This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch feature/include-tag-params in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/feature/include-tag-params by this push: new c00bcb66a Adds more detailed examples c00bcb66a is described below commit c00bcb66ae41b8973f3a9a671c63a358b5c5132e Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Sun Oct 29 10:34:59 2023 +0100 Adds more detailed examples --- source/tag-developers/include-tag.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/source/tag-developers/include-tag.md b/source/tag-developers/include-tag.md index 489b0abbe..ff976f553 100644 --- a/source/tag-developers/include-tag.md +++ b/source/tag-developers/include-tag.md @@ -25,11 +25,21 @@ the `<s:property/>` tag to access parameters in included files. Below it's an example how you can access parameters passed into the included page: +with scope: ``` <s:set var="paramName" scope="page">${param.paramName}</s:set> <s:property value="paramName"/> ``` +with no scope: +```jsp +<s:set var="paramName">${param.paramName}</s:set> +<s:property value="paramName"/> + +<s:property value="#attr.paramName"/> +<s:property value="#paramName"/> +``` + > **Note**: You can access such params without using JSTL, just use > `${param.paramName}` notation. ## Attributes @@ -70,10 +80,19 @@ do an include to `myJsp.jsp` page with parameters `param1=value1` and `param2=va **Example 4** +accessing passed parameters in the included page + +with scope: ```jsp <s:set var="param1" scope="page">${param.param1}</s:set> -Param1 = <s:property value="param1"/> -Param2 = ${param.param2} +<s:property value="#attr.param1"/> ``` -do access passed parameters in the included page +with no scope: +```jsp +<s:set var="param2">${param.param2}</s:set> +<s:property value="param2"/> + +<s:property value="#attr.param2"/> +<s:property value="#param2"/> +```