Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Jakarta Server Pages
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== The useBean Tag ==== The JSP <code>useBean</code> tag enables the developer to access and create a Javabean.{{sfn | Murach | Urban | 2014 | loc=Β§2 Essential servlet and JSP skills - Summary | pp=198}} Although using the <code>useBean</code> tag looks similar to an HTML tag, all JSP tags for JavaBeans use XML syntax. Therefore the code containing the <code>useBean</code> tag is case-sensitive.{{sfn | Murach | Urban | 2014 | loc=Β§2 Essential servlet and JSP skills - How to code the useBean tag | pp=186-187}} The <code>useBean</code> tag contains several attributes. The <code>id</code> attribute declares the name that is used for gaining access to the bean. The <code>class</code> attribute declares the package and class for the bean. The <code>scope</code> declares the object responsible for storing the bean. The value for the scope defines the duration for which the bean is available for the rest of the java application to use. The scope can be one of the following four values: {{sfn | Murach | Urban | 2014 | loc=Β§2 Essential servlet and JSP skills - How to code the useBean tag | pp=186-187}} * The {{code|page}} scope implies that the bean is located in the implicitly defined {{Javadoc:EE|javax/servlet/jsp|PageContext}} object, and is only available for the current page. By default, all beans have a scope of {{code|page}}. * The {{code|request}} scope implies that the bean can be found in the {{Javadoc:EE|javax/servlet/http|HttpServletRequest}} object. This bean can be accessed by all other JSPs and servlets that have access to the current request object. * The {{code|session}} scope implies that the bean can be found in the {{Javadoc:EE|javax/servlet/http|HttpSession}} object. This bean can be accessed by all other JSPs and servlets that have access to the specified {{code|HttpSession}} object. * The {{code|application}} scope implies that the bean can be found in the {{Javadoc:EE|javax/servlet|ServletContext}} object. This bean can be accessed by all other JSPs and servlets that have access to the specified {{code|ServletContext}} object.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)