Gundon
Gundon

Reputation: 2121

PageContext's scope

In my understanding the method findAttribute(String) of the class PageContext searches for findings in all scopes (Session, Request, Pagecontext..).

Is that really so?

I have a JSP with the following code

String foo = request.getParameter("foo"); %>
<%= pageContext.findAttribute("foo") %> -- <%= foo %> -- ${foo}

So in my understanding if I previously set the requests parameter foo to anything like boo and the session and pagecontext is clean, all 3 outputs would deliver boo.

But in my case only the output in the middle says boo. <%= pageContext.findAttribute("foo") %> and ${foo} have no o

Upvotes: 1

Views: 2274

Answers (1)

Zack Macomber
Zack Macomber

Reputation: 6905

pageContext.findAttribute will retrieve attributes which are different than parameters.

See Difference between getAttribute() and getParameter() for more details.

Upvotes: 2

Related Questions