• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

scope attribute (HFSJ)

 
sangeeta kapoor
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 355 HFSJ



If you don't specify scope in either the <jsp:useBean> or <jsp:getProperty> tags, the container uses the default of "page"


I have only used scope in <jsp:useBean>.
Can scope be specified in <jsp:getProperty> , if yes when is it used ?
 
Rodrigo W Bonatto
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

<jsp:getProperty> tag doesn't have the scope attribute.
I think you can specify the scope only in the <jsp:usebean> tag.

Rodrigo
 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rodrigo is right. The below is the JSP 2.0 specification

Syntax
<jsp:getProperty name=�name� property=�propertyName� />
The attributes are:

jsp:getProperty Attributes

name The name of the object instance from which the property is
obtained.
property Names the property to get.

whereas jsp:useBean has scope

This action may or not have a body. If the action has no body, it is of the form:
<jsp:useBean id="name" scope="page|request|session|application" typeSpec />
typeSpec ::= class=�className� |
class=�className� type=�typeName� |
type=�typeName� class=�className� |
beanName=�beanName� type=�typeName� |
type=�typeName� beanName=�beanName� |
type=�typeName�


Hope this helps.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

The <jsp:getProperty> doesn't have a scope attribute. The value of the attribute will refer to an object that is obtained from pageContext object through its findAttribute method.

That means it searches the named attribute in page, request, session (if valid), and application scopes in order and return the value.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic