• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

scope and toScope

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the difference between scope and toScope attributes in Bean define tag in struts ?

The books says:
scope : Specifies the variable scope searched to retrieve the bean specified by name. If not specified, the default rules applied by PageContext.findAttribute() are applied.


toScope : Specifies the variable scope into which the newly defined bean will be created. If not specified, the bean will be created in page scope.


But the same is not clear to me. can anyone explain the same?

Regards
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's say in your Action class you had the following line:

This gives you a request scoped variable with the name "AnswerToLife" and a value of 42.
Then in your JSP, you have the following statement:
This creates a new variable in session scope named UlitmateAnswer that takes as its value the value of the request scoped variable AnswerToLife.
[ November 16, 2007: Message edited by: Merrill Higginson ]
 
Rohit Sajan
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Merril.

Regards
Saju
 
reply
    Bookmark Topic Watch Topic
  • New Topic