Re: Assigning Sessions values from DirectAction.java
Re: Assigning Sessions values from DirectAction.java
- Subject: Re: Assigning Sessions values from DirectAction.java
- From: Art Isbell <email@hidden>
- Date: Thu, 27 Mar 2003 13:29:13 -1000
On Thursday, March 27, 2003, at 12:47 PM, Riaz Lalehzari wrote:
In my action method I say:
Session session;
session = (Session)session();
((Session)session()).value = variable;
For this to work, the "value" variable in Session would need to be
declared public. In general, this isn't a great idea. Instead,
declare instance variables to be private (or protected if a subclass
needs direct access) and implement public accessor methods such as
setValue():
((Session)session()).setValue(variable);
What is confusing me is that if I cut and paste the code from my
action method into another java files method and assign the value
there, all other methods can see the same value I assigned correctly.
Check to see whether the session object is the same one in all cases.
You may be doing something that's creating additional session objects
so that the session object whose "value" variable was set is not the
same session object whose "value" variable was later accessed.
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.