This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Struts and the fly likes scoping difference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "scoping difference" Watch "scoping difference" New topic

scoping difference

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401


May i know what are the difference among the scopes we set in the different places.

Say, my variable name called String name; is in the the form bean which, of course, has session scope.
differnt senariaos,what will happen
in my struts-config if i mention scope= request.
in my action class if i set the value of the name to session.
and in my jsp if i use some other scope.

may i know the actual process to be followed and priority is given to different files for the same scope variables.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This link contains an article that explains J2EE scopes pretty well. If you have the same variable name in different scopes and don't specify a scope in say, a bean:write tag, my understanding is that it will use the narrowest scope. For example, if you have the variable "foo" in both request and session scope, it will pick up the one in request scope first.

Consultant, Sima Solutions
I agree. Here's the link:
subject: scoping difference
It's not a secret anymore!