Re: unstatable implement

2009-11-30 Thread Brian Thompson
This is just a guess, but is this "line 10" in your C0002_HomeAction class? if((ses.get("context").toString()!="")&&(ses.get("role").toString()=="admin")){ Based on the exception, I'd say that the Session being null is what's causing the exception. Try changing that line to if((ses != null) &&

Re: unstatable implement

2009-11-29 Thread Chris Pratt
While you're absolutely correct that the preferred method of getting to the session attribute map is by implementing the SessionAware interface, calling ServletActionContext.getContext().getSession() (as Nguyen did) will give you the Map. And you are also correct that if you actually need to get h

Re: unstatable implement

2009-11-29 Thread KamHon Eng
to able to retrieve session object in Action class, there are 2 ways, 1st way is using ServletActionContext.getRequest().getSession() it will giving u a HttpSession object. 2nd way is, your Action class implements org.apache.struts2.interceptor.SessionAware. Please refer to JavaDoc. For your info

Re: unstatable implement

2009-11-29 Thread Denis Cabasson
Obviously, if you don't have a session, ses.get("context") will return null. And null.toString() that's a nice NPE. I usually use StringUtils.isNotEmpty for commons-lang : http://commons.apache.org/lang/api-release/org/apache/commons/lang/StringUtils.html#isNotEmpty(java.lang.String)

Re: unstatable implement

2009-11-29 Thread Saeed Iqbal
Yes the toString of null is whats causing your error On Monday, November 30, 2009, Nguyen Xuan Son wrote: > on line 10 I have > if(!ses.get("context").equals(null)&&!ses.get("role").equals(null)){ > if(!ses.get("context").toString().isEmpty()&&!ses.get("role").toString().isEmpty()){ > > thanks fo

Re: unstatable implement

2009-11-29 Thread Nguyen Xuan Son
on line 10 I have if(!ses.get("context").equals(null)&&!ses.get("role").equals(null)){ if(!ses.get("context").toString().isEmpty()&&!ses.get("role").toString().isEmpty()){ thanks for your considering 2009/11/30 Saeed Iqbal > Whats on line 10 > > On Monday, November 30, 2009, Nguyen Xuan Son >

Re: unstatable implement

2009-11-29 Thread Chris Pratt
Isn't ses.get("context") going to always return null the first time thru? (*Chris*) P.S. You should look at using an Interceptor for this check. This type of situation is exactly what they were invented for. On Sun, Nov 29, 2009 at 5:54 PM, Nguyen Xuan Son wrote: > dear all > I have the C000

Re: unstatable implement

2009-11-29 Thread Saeed Iqbal
Whats on line 10 On Monday, November 30, 2009, Nguyen Xuan Son wrote: > dear all > I have the C0002_Home.jsp and sessionChk.jsp files. The C0002_Home.jsp's > source code is > > > the meaning of this source code is to check users session whenever they > enter the webpage > the struts.xml is struc