I found out what I was looking for:
http://struts.apache.org/2.0.6/docs/how-do-we-get-access-to-the-session.html
but still wondering why would ActionContext.getContext().getSession()
returns a session the first time it's called then it returns null?
Mansour wrote:
I am trying to setup a value in my session. IT works the first time I
call the action, and breaks the second time.
I get null pointer exception. This code is from my constructor.
Map session = ActionContext.getContext().getSession();
if (session.containsKey("InvoiceManager"))
this.invManager = (InvoiceManager)
session.get("InvoiceManager");
else {
invManager = new InvoiceManager();
session.put("InvoiceManager", invManager);
}
Here' the exception:
java.lang.NullPointerException
at action.InvoiceAction.<init>(InvoiceAction.java:25)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
Any Idea what's going on ?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]