• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot make a static reference to the non-static method setAttribute from the type JspContext

 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to access a attribute from the session scope in the JSP by
<%= PageContext.getAttribute("AccessSession",PageContext.SESSION_SCOPE) %>

The session attribute is set in a servlet and then forwarded the request to the JSP


But i am getting error as
An error occurred at line: 8 in the jsp file: /DifferentScopeAccess.jsp
Cannot make a static reference to the non-static method setAttribute(String, Object) from the type JspContext


Please guide me
 
Ankit Garg
Sheriff
Posts: 9597
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PageContext is a class, pageContext (with lower case p) is the instance of PageContext available to a JSP page...
 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I missed it .. thanks
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!