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 <saee...@gmail.com> > Whats on line 10 > > On Monday, November 30, 2009, Nguyen Xuan Son > <nr000...@ed.ritsumei.ac.jp> wrote: > > dear all > > I have the C0002_Home.jsp and sessionChk.jsp files. The C0002_Home.jsp's > > source code is > > <s:action name="SessionCheck"></s:action> > > > > the meaning of this source code is to check users session whenever they > > enter the webpage > > the struts.xml is structured as: > > <action name="SessionCheck" class="com.baibai.action.SessionCheckAction"> > > <result name="input">sessionChk.jsp</result> > > </action> > > <action name="C0002_Home" class="com.baibai.action.C0002_HomeAction"> > > <result name="input">C0002_Home.jsp</result> > > </action> > > > > the detail of the SessionCheckAction.java file is > > public class SessionCheckAction extends ActionSupport{ > > public String execute() throws Exception { > > Map ses = ActionContext.getContext().getSession(); > > > if((ses.get("context").toString()!="")&&(ses.get("role").toString()=="admin")){ > > // the user is loginned as an administrator > > System.out.println("you have session"); > > } else { > > System.out.println("you dont have session"); > > } > > return SUCCESS; > > } > > } > > > > however when i tried to enter the C0002_Home.jsp without Login > > the error appears > > 2009/11/30 10:40:07 > > com.opensymphony.xwork2.util.logging.commons.CommonsLogger error > > 致命的: Could not execute action: /SessionCheck > > java.lang.NullPointerException > > at > com.baibai.action.SessionCheckAction.execute(SessionCheckAction.java:10) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > > at java.lang.reflect.Method.invoke(Unknown Source) > > > > this doesnt happen if I login into the system > > could you tell me where did I went wrong > > > > -- > > ======================================================================= > > Ritsumeikan University, Asia JinZai Project > > Master of Information Science > > Nguyen Xuan Son > > > > Add : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 > ShiteiHaimu > > Rien, Room 103 > > Tel/Fax : 81-(0)90-3976 2246 > > Email : nr000...@ed.ritsumei.ac.jp > > Mobile : 81-(0)90-3976 2246 URL : http://www.ritsumei.jp > > ======================================================================= > > > > -- > Saeed Iqbal > Independant Consultant (Freelance) > Struts - J2EE - Application Architect / Developer > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- ======================================================================= Ritsumeikan University, Asia JinZai Project Master of Information Science Nguyen Xuan Son Add : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu Rien, Room 103 Tel/Fax : 81-(0)90-3976 2246 Email : nr000...@ed.ritsumei.ac.jp Mobile : 81-(0)90-3976 2246 URL : http://www.ritsumei.jp =======================================================================