Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830
this week in the
Programmer Certification
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Struts
NullPointerException
Shibin Paul
Greenhorn
Posts: 18
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
struts-cofig.xml --------------------------------- <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd"> <struts-config> <form-beans> <form-bean name = "LoginForm" type = "com.example.LoginForm" /> <form-bean name = "UserDetailsForm" type = "com.example.UserDetailsForm" /> </form-beans> <global-forwards> <forward name = "UserDet" path="UserDetails.jsp"></forward> </global-forwards> <action-mappings> <action path = "/confirm" type = "com.example.UserDetailsAction" name = "UserDetailsForm" > <forward name = "success" path = "/Success.jsp" /> </action> </action-mappings> <message-resources parameter="com.example.messageProperties" /> </struts-config> -------------------------------------------------- UserDetails.jsp -------------------------------------------------- <%@ taglib uri = "/WEB-INF/struts-html" prefix = "html" %> <%@ taglib uri = "/WEB-INF/struts-bean" prefix = "bean" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html:html> <head> <title>User Details</title> </head> <body> <html:form action="confirm"> First Name:<html:text property = "fname" value = "asdf" /><br> Middle Name:<html:text property = "mname" value = "asdf" /><br> Last Name:<html:text property = "lname" value = "asdf" /> </html:form> </body> </html:html> -------------------------------------------- UserDetailsForm.java --------------------------------------------- package com.example; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public class UserDetailsForm extends ActionForm { String fname=null; String mname=null; String lname=null; public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } } -------------------------------------------- UserDetailsAction.java -------------------------------------------- package com.example; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class UserDetailsAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm fm, HttpServletRequest request, HttpServletResponse response) { System.out.println("Inside Actrion"); String target = "success"; return mapping.findForward(target); } } ***************************************************** The error that is getting generated ****************************************************** java.lang.NullPointerException at org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:212) at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:292) at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:191) at org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:477) at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:457) at org.apache.jsp.UserDetails_jsp._jspx_meth_html_form_0(UserDetails_jsp.java:122) at org.apache.jsp.UserDetails_jsp._jspx_meth_html_html_0(UserDetails_jsp.java:98) at org.apache.jsp.UserDetails_jsp._jspService(UserDetails_jsp.java:68) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:534) -------------------------------------------- Thanks in advance
Merrill Higginson
Ranch Hand
Posts: 4864
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I don't see anything obviously wrong. Try changing:
<html:form action="confirm">
to
<html:form action="/confirm">
and see if that fixes it.
Merrill
Consultant,
Sima Solutions
Shibin Paul
Greenhorn
Posts: 18
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No It didnt solve the problem.Also found that the classes folder is empty.
Shibin Paul
Greenhorn
Posts: 18
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Found the solution.Due to some reason the
IDE
was not compiling the source code.Made another proj with same src files and it is working fine now.
All that thinking. Doesn't it hurt? What do you think about this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Validation error
Struts - Error creating form bean
this problem is resume
html:iterate or html:multibox problem
pls help me out with this error
More...