This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes ValidationForm causes error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ValidationForm causes error" Watch "ValidationForm causes error" New topic
Author

ValidationForm causes error

pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
I have put validation to my struts application using validation framework and it caused errors, I think it's because of i'm calling ActionForm from the JSP, anyone has any idea to solve this?
This is the errors from tomcat console

INFO: Tiles definition factory found for request processor ''.
Feb 14, 2007 8:54:39 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.pages.procurement.purchasing.CICS110104JSP_jsp._jspService(org.apache.jsp.pages.procurement.purchasing.CICS110104JSP_jsp:113)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:604)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at org.apache.jsp.tiles.WICSLayoutJSP_jsp._jspx_meth_tiles_insert_2(org.apache.jsp.tiles.WICSLayoutJSP_jsp:283)
at org.apache.jsp.tiles.WICSLayoutJSP_jsp._jspx_meth_html_html_0(org.apache.jsp.tiles.WICSLayoutJSP_jsp:149)
at org.apache.jsp.tiles.WICSLayoutJSP_jsp._jspService(org.apache.jsp.tiles.WICSLayoutJSP_jsp:80)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:341)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:966)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
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:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Feb 14, 2007 8:54:39 AM org.apache.struts.taglib.tiles.InsertTag$InsertHandler doEndTag
SEVERE: ServletException in '/pages/procurement/purchasing/CICS110104JSP.jsp': null

Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
The exception is happening in JSP file
org.apache.jsp.pages.procurement.purchasing.CICS110104JSP_jsp:113

It helps if you can tell us what exactly this line is and your validation.xml is not correct. I guess you are confused about "mask" and "min/maxlength" validations. Min/Max validation arg value must be an integer. Try changing the var-value for these validation to 5 (from your reg expression).

Take a look at this page http://struts.apache.org/1.2.9/userGuide/dev_validator.html
[ February 13, 2007: Message edited by: Purushothaman Thambu ]
pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
Sorry, i forgot to add my JSP pages
Here is snippet of my JSP, i use javascript function to submit action

pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
Sorry, i forgot to add my JSP pages
Here is snippet of my JSP, i use javascript function to submit action

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This looks like a simple NullPointerException in your JSP. I doubt it has anything to do with validation. Does your log file show the output from the System.out.println statment? If not, the problem is most likely that the result of request.getAttribute("CICS110104Form") is null. If so, find out why it's null. Once you do, you're well on your way to fixing the problem.


Merrill
Consultant, Sima Solutions
pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
Yes, i have debug and it result null when it call CICS110104Form
However, when i changed CICS110104Form from extending ValidatorForm to ActionForm my struts application work fine.
I think i should change the way i call CICS110104Form, anyone knows how?

Thanks,

paula
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Show us the entries in your struts-config.xml file that define this ActionForm and the Action that goes with it.
pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
Here is my struts-config.xml

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The problem appears to be a disconnect between what you've defined in your struts-config.xml file and your JSP. You've declared that the ActionForm bean for this action is in session scope, yet in your JSP, you're trying to retrieve it from the request. Change this

to this
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ValidationForm causes error
 
Similar Threads
problem with getOutputStream() has already been called for this response
Validation error
Struts 1.2 Cannot find bean org.apache.struts.taglib.html.BEAN
My html:select is not working
Bacis doubt input property in struts-config.xml