• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Assigning Sessions values from DirectAction.java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Assigning Sessions values from DirectAction.java (From: "Riaz Lalehzari" <email@hidden>)

  • Prev by Date: Using Java 1.3.1 when you've already installed 1.4.0
  • Next by Date: Re: Using Java 1.3.1 when you've already installed 1.4.0
  • Previous by thread: Re: Assigning Sessions values from DirectAction.java
  • Next by thread: newbie question -- I cannot get EOModeler to go anything
  • Index(es):
    • Date
    • Thread