This document was generated from CDN thread
Created by: null on 01-08-2007 05:33:34 PM
Is there a way on an element to access the members of a java object that is in the session? Here is the situation I am trying get to work.
I have a java object that contains four member variables and their appropriate setters and getters.
[b:2c8ec2f7c0][u:2c8ec2f7c0]Test[/u:2c8ec2f7c0][/b:2c8ec2f7c0]
String one;
String two;
String three;
String four;
On an element I would like to reference the member variables of this object when it is in the session. I currently get an error when I try to use the dot notation more than one level deep.
I create a new instance of Test and name it â¿¿testâ¿¿ and added it to the session as â¿¿testâ¿¿. I would like to access the member variables on an element and in XML like this:
In XLM
<data>
<session name="test.oneâ¿¿/>
</data>
Element
{Data.Session.test.two}
Please let me know if there is a way to access members of an object in the session.
Subject: RE: Session dot notation
Replied by: null on 01-08-2007 06:45:36 PM
Fascinating idea.
Why not just write a custom Java decision class and have it all happen quite logically and at high speed? 😉
Regards,
Geoff
Subject: RE: Session dot notation
Replied by: null on 02-08-2007 02:23:56 PM
So are you saying it is not possible?
Subject: RE: Session dot notation
Replied by: null on 02-08-2007 10:01:20 PM
Hello,
There are two ways in which elements can access members of a Java object.
One option is to store the member variables as separate objects in the session that can go into multiple element data or session data variables using substitution.
The other option is to access the session object at a Java level using custom code, like in a custom Action element. The custom class has access to the Session API class which can be used to extract the object stored in the session. Once the reference to the object is obtained, its members variables can be accessed.
Hope this helps.
Harish.