• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scope Attribute for jsp:set and jsp:get

 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I used <jsp:useBean id="operson" class="Person" scope="request" >
<jsp:setProperty name="operson" property="name" value="hi" Scope="request" />
<jsp:getProperty name="operson" property="name" Scope="request" />
</jsp:useBean>

But Tomcat throws up an Jsp Compile Time Error saying invalid attribute Scope in jsp:get and jsp:set tags that means we cant specify the Scope Attribute for these tags.

But in HFSJ page number 355 it is stated that the default scope for <jsp:useBean> and <jsp:getProperty> is Page scope I checked Errata nothing is specified about this.

I think we cant have scope attribute specified in the <jsp:setProperty> and <jsp:getProperty> tags.

Thanks
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is scope attribute for the setProperty nor getProperty.
you introduce the bean using useBean and there you specify the scope. Now whenever you se/get a property, you will be working on a bean that you have introduced using the useBean. i.e there is no point in having the scope again for get/set properties.

HINT specs.
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi raja ram

i think in your code as per you have shown just note overhere:




May be this is leading to compiler error see below:>

and not

and what Musab Al-Rawi said is absolutely correct
there is no point in giving scope while setting and
getting properties,since we already decide the Bean
scope in UseBean Tag.

I hope it help you to some extent.

SCJP(1.5),SCWCD(On the Way...)
Dhwani:>Winning is not important but it is the only thing.
[ May 06, 2008: Message edited by: dhwani mathur ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic