Hello everyone,
I am trying to write a class that will read some values from properties
file into array and then store this array in the user session.
I want to do it using toolbox.xml,
I created an entry
<tool>
<key>localeData</key>
<scope>session</scope>
<class>com.test.LocaleDataReader</class>
</tool>
And the class LocaleDataReader is
public class LocaleDataReader {
public void init(Object obj)
{
HttpServletRequest request = ((ViewContext)obj).getRequest();
}
public LocaleDataReader(){}
public ArrayList<String> getCurrentABC(){
ArrayList<String> currentABCtmp = new ArrayList<String>();
// will read locale properties file, for now only
currentABCtmp.add("value");
return currentABCtmp;
}
}
Here is the question :
A. How can I store currentABCtmp variable into the session, so next
time the call getCurrentABC() will return value from session. How can I
access the session from this Method.
B. Why init() is never called? Who should call it? I saw init() in the
source of some tools, I thought that how I can get access to session.
C. I don't see any difference using debug between request and session
scope of the entry in toolbox.xml, why is it?
Thanks a lot,
Gil.