• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Use of a page-scoped attribute

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I don't understand why anyone will use a page-scoped attribute ,the attribute will have a lifetime till the control is in that page so, why should anyone will be setting and getting an attribute in the same page?

Thanks
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To use the variable only in that page. Think of <c:set var="" value="" />.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know of any other way of using, setting or getting, a variable in a scriptlet-less page.
 
Dash Abhisek
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
But, if i am having access to a variable then what is the point in setting it in an attribute and getting it from that attribute ?

Thanks
Abhisek
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The same reason that anyone would need a local variable within a Java method. For information of short duration needed for the current unit.

Would you really want to store temporary values (such as loop counters and the like) in any other scope?
[ October 29, 2008: Message edited by: Bear Bibeault ]
 
Dash Abhisek
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot ,my doubt is cleared
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dash Abhisek:
But, if i am having access to a variable then what is the point in setting it in an attribute and getting it from that attribute ?



You don't have the access to any variable, in the case of scriptlet-less page, without setting it in a scope.
[ October 29, 2008: Message edited by: Adeel Ansari ]
 
Dash Abhisek
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Adeel,

no where I have mentioned I am using a scriptless jsp.I am talking about
jsps in general nevertheless my doubt is cleared
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dash Abhisek:
no where I have mentioned I am using a scriptless jsp.



I know but you should. Otherwise, you don't need quite a few things and you assume those useless or doesn't serve any purpose.

Moreover, example given by Bear, also has been made by keeping scriptless JSP in mind, I believe.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adeel is correct. There is no good reason not to be writing scriptless JSPs at this juncture.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic