I am doing a webapp in struts... i'm using a sample program i found during my web 
searches.
I was able to do fine, like saving and deleting but i always seem to get this error 
whenever i
try to setting the form to the session.

My code is:
   GetUserAccountService service = null;
    UserAccountForm userAccountForm = null;
    if(tmUserId != null){
     service = new GetUserAccountService();
     userAccountForm = new UserAccountForm();
     service.setServlet(servlet);
     userAccountForm = service.getUserAccount(Integer.parseInt(tmUserId));
     form = (ActionForm)userAccountForm;
     if( form == null){
   System.err.println("---> userAccountForm is Null!");
   }
     System.err.println("---> Test form.getUserid: " + userAccountForm.getUserid());
     System.err.println("---> Test form.getUsername: " + 
userAccountForm.getUsername());
     System.err.println("---> Test mapping: " + mapping.getAttribute());
     //Save form in session for editing
     try{
      session.setAttribute(mapping.getAttribute(), form);
      request.setAttribute(mapping.getAttribute(), form);
  }catch (Exception e) {
        System.err.println("ERROR:"+e.getMessage());
        e.printStackTrace(System.err);
   }
 }

>>>>>
the error is:

java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:394)
        at com.caucho.server.http.Request.setAttribute(Request.java:1480)
        at com.fltic.crm.action.manager.EditTmAccountAction.execute(EditTmAccoun
tAction.java:104)
        at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:465)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:142
2)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet
.java:96)
        at com.caucho.server.http.Invocation.service(Invocation.java:312)
        at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:1
35)
        at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:244
)
        at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:
163)
        at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
        at java.lang.Thread.run(Thread.java:536)

>>>>> Hope anyone would help me. thanks a lot.

This code i provided is for my Edit action classes.

Thanks a lot again.


-Richard

Reply via email to