This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting NullPointerException on calling Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting NullPointerException on calling Action" Watch "Getting NullPointerException on calling Action" New topic
Author

Getting NullPointerException on calling Action

Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
I am getting nullpointerexception after clicking submit button in SignUp.jsp and control goes to Action.
Line number 19 is

Full Details as follows...

Struts Problem Report
Struts has detected an unhandled exception:

Messages:
File: coreservlets/action/SignupAction1.java
Line number: 19

java.lang.NullPointerException
coreservlets.action.SignupAction1.execute(SignupAction1.java:19)

Struts.xml



SignUp.jsp




SignupAction1.java



Please suggest. Thanks in advance !
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8834
    
    7

Look real hard at the code below. See anything?



"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
oops sorry my bad !
Thanks
victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
I could not see the error... can anybody explain it? thanks..

Im a newbie here.

regards,
Vic
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8834
    
    7

Struts uses the name of HTML form elements to look up properties of an action. If you name a form element like this:



You need to provide a getter and setter for a property called formBean. If you look at my post above, you can see the getter and setter names do not match.
 
 
subject: Getting NullPointerException on calling Action
 
Similar Threads
i do not understand servlet request.setAttribute ~
Error setting the expression with value [Ljava.lang.String;@1d05b0a
Error while validating the input
Problem: Cannot find bean "messageBean" in any scope
Struts2 - execAndWait Interceptor