You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gilson Nascimento D Elrei <gi...@cpm.com.br> on 2002/03/26 17:30:32 UTC

error null value not accept... helpme

I'm receiving the error below when i try to execute a simple login
application

null
java.lang.NullPointerException
	at test.struts.LoginBean.validate(LoginBean.java:30)
	at test.struts.LoginAction.perform(LoginAction.java:20)
	at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1787)

What occur is that my LoginAction Servlet instance a validate LoginBean and
execute its Validate method passing for it
the Request object (it's a normal process), depending
about  validated condition processed by  LoginBean  it can to return a null
ActionError object, like in that piece of code below, but
itsn't seems ok.


In the LoginAction class

     LoginBean lb = new LoginBean();
     request.setAttribute("LoginBean",lb);
     lb.setParameteres(request);

     ActionErrors ae = lb.validate();            <--  I got error here!
(null value not accept!?)
     request.setAttribute(Action.ERROR_KEY, ae);
     
     if (ae==null || ae.size() == 0 )
     {
           return mapping.findForward("valid");    
    }
    else
    {
          return mapping.findForward("invalid");
    }
     
--- end code
any idea ?
Thanks in advance
          

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: error null value not accept... helpme

Posted by Oliver Reflé <o....@gmx.de>.
I think your null pointer occurs in the LoginBean method validate()
so can you show this code ?

-----Original Message-----
From: Gilson Nascimento D Elrei [mailto:gilson.rei@cpm.com.br]
Sent: Tuesday, March 26, 2002 5:31 PM
To: 'Struts Users Mailing List'
Subject: error null value not accept... helpme


I'm receiving the error below when i try to execute a simple login
application

null
java.lang.NullPointerException
	at test.struts.LoginBean.validate(LoginBean.java:30)
	at test.struts.LoginAction.perform(LoginAction.java:20)
	at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1787)

What occur is that my LoginAction Servlet instance a validate LoginBean and
execute its Validate method passing for it
the Request object (it's a normal process), depending
about  validated condition processed by  LoginBean  it can to return a null
ActionError object, like in that piece of code below, but
itsn't seems ok.


In the LoginAction class

     LoginBean lb = new LoginBean();
     request.setAttribute("LoginBean",lb);
     lb.setParameteres(request);

     ActionErrors ae = lb.validate();            <--  I got error here!
(null value not accept!?)
     request.setAttribute(Action.ERROR_KEY, ae);

     if (ae==null || ae.size() == 0 )
     {
           return mapping.findForward("valid");
    }
    else
    {
          return mapping.findForward("invalid");
    }

--- end code
any idea ?
Thanks in advance


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>