This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch feature/clarify-attr-search in repository https://gitbox.apache.org/repos/asf/struts-site.git
commit 09f54bf385048626216bfe72a4ab9fb042c4cd68 Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Tue Oct 31 10:23:19 2023 +0100 Clarifies how #attr works and other scopes --- .../accessing-application-session-request-objects.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/core-developers/accessing-application-session-request-objects.md b/source/core-developers/accessing-application-session-request-objects.md index 774d1cfd1..7b0fcd3dd 100644 --- a/source/core-developers/accessing-application-session-request-objects.md +++ b/source/core-developers/accessing-application-session-request-objects.md @@ -64,13 +64,13 @@ Page attributes are accessed via OGNL using the `#attr` stack value, and Applica the `#application` stack value. The `#attr` stack value will search the `javax.servlet.jsp.PageContext` for the specified key. If the `PageContext` -doesn't exist, it will search the request, session, and application scopes, in that order. +doesn't exist, it will search the `request`, `session` and `application` scopes, in that order. -**Accessing attributes in the Application, Session, Request, or Page scope from a JSP** +**Accessing attributes in the Application, Session, Request or Page scope from a JSP** -```jsp -<p>Retrieve the attribute (property), with key myId, from the specified scope:</p> +Retrieve the attribute (property), with key `myId`, from the specified scope: +```jsp <s:property value="#application.myId" /> <s:property value="#session.myId" /> @@ -78,6 +78,8 @@ doesn't exist, it will search the request, session, and application scopes, in t <s:property value="#request.myId" /> <s:property value="#attr.myId" /> - -<p>Reminder: #attr is for Page scope attributes first, but will search the remaining scopes, in order, seeking a match.</p> ``` + +**Note**: `#attr` is for Page scope attributes first, but will search the remaining scopes, in order, seeking a match. +In opposite using just `#` means you want to fetch a value from the top of the [ValueStack](../tag-developers/access-to-valuestack-from-jsps.md) +without searching down the stack.