Scope of JSP Objects

10/06/2008

The availability of a JSP object for use from a particular place of the application is defined as the scope of that JSP object. Every object created in a JSP page will have a scope. Object scope in JSP is segregated into four parts and they are page, request, session and application.

  • page
    ‘page’ scope means, the JSP object can be accessed only from within the same page where it was created. The default scope for JSP objects created using <jsp:useBean> tag is page. JSP implicit objects out, exception, response, pageContext, config and page have ‘page’ scope.
  • request
    A JSP object created using the ‘request’ scope can be accessed from any pages that serves that request. More than one page can serve a single request. The JSP object will be bound to the request object. Implicit object request has the ‘request’ scope.
  • session
    ‘session’ scope means, the JSP object is accessible from pages that belong to the same session from where it was created. The JSP object that is created using the session scope is bound to the session object. Implicit object session has the ‘session’ scope.
  • application
    A JSP object created using the ‘application’ scope can be accessed from any pages across the application. The JSP object is bound to the application object. Implicit object application has the ‘application’ scope.

sdf

dsf on July 24th, 2010 7:11 am

Hi,Your explanation about scope of jsp objects is very good.It is very helpful to me.I found the clear information about the jsp objects scope.

Thanks….Keep Posting similar articles.

Muralidhar on October 4th, 2010 10:02 am

expalain in detail

Anonymous on October 10th, 2010 7:52 am

Excellent!

Nishit Shah on November 25th, 2010 3:04 pm

Your explanation about the JSP scope objects is really good.
But if i’m not going to use <jsp:useBean tag in the form then what will be scope of the jsp page.Is it page or else any other scope from the remaining.

ANAND on December 28th, 2010 8:33 am

its true…………..

sushma on April 17th, 2011 3:07 pm

jsp:tags in detail??????/

sushma on April 17th, 2011 3:09 pm

thank for good explanation;
shohag

Anonymous on April 26th, 2011 2:33 pm

very nice explanation…

thank you Joe

ramesh on April 28th, 2011 11:01 am

exellent explanation….
its really a useful article…
thnks..

Jyotshna Pardhia on May 16th, 2011 11:28 am

exellent explanation….

sam on May 25th, 2011 10:59 am

it is not a good example……

nik on June 6th, 2011 9:32 am

Hi,

Scope of JSP Objects are

1.request
2.responce
3.application
4.session
5.out
6.config
7.pagecontet
8.page
9.exception

SHOWNISHA on June 22nd, 2011 9:34 am

Hi,

I read your article easy to understand for freshers and usefulll…

do the needful thro out your life

SHOWNISHA on June 22nd, 2011 9:37 am

Hi SHOWNISHA,

The list you had given above are JSP implicit objects. You are mistaken that with the scope of JSP object.

Sunitha PV on June 24th, 2011 9:17 am

Stellar work there eveoynre. I’ll keep on reading.

Janese on August 14th, 2011 6:39 pm

TO Shownisha: Hi, 9 objects which you had listed out were not scope of the JSP objects, they are implicit objects. What joe mentioned those 4 are scopes

rajasekhar on August 21st, 2011 4:04 am

thanks,

Hiren Raiyani on October 17th, 2011 3:52 am

Hi…

bhg dfh f g dh
fgd df

hfghfhf

Joe on November 3rd, 2011 9:22 am

could u pls send example for each scope objects in jsp

syamsunder on November 17th, 2011 6:54 am

good one.

Krishna Mohan on December 26th, 2011 10:14 am

I LIKE JAVA VERY VERY MUCH,I ALSO JAVA SE 6 CERTIFIED PROFESSIONAL(OCJP 6). GIVE NEXT STEP FOR MY BRIGHT FUTURE…

NARASIMHA on January 10th, 2012 12:13 pm


Email:

about
I am Joe, author of this blog. I run this with loads of passion. If you are into java, you may find lot of interesting things around ...more about me. Google+
java badge
Home