I have an an HTML form displayed on a jsp with struts html:form tags. In the validate method, I have a checkForEmpty and checkForNumber method that will check whether the field is empty or not a number (as applicable) and if so, add an ActionError to the ActionErrors object. The validate method works if all fields are correctly filled in and the control gets handed off to the Action associated with the form's submit button. However, if there are errors, then I get the following exception:
javax.servlet.ServletException: Failed to obtain specified collection at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:495) at org.apache.jsp.watermarkJobDetails_jsp._jspService(watermarkJobDetails_jsp.java:94) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92) at javax.servlet.http.HttpServlet.service(HttpServlet.java:809) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187) at javax.servlet.http.HttpServlet.service(HttpServlet.java:809) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:627) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:306) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012) at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:716) at javax.servlet.http.HttpServlet.service(HttpServlet.java:809) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152) 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:683) at java.lang.Thread.run(Thread.java:479) The form contains the following types of struts html tags: 4 nested:select elements, these are backed by a Collection of LabelValueBeans. One of them has it's own Collection object. The other three reference the same Collection object, but each of these have their own String object representing the selected option item. The collections associated with these form items are prepopulated during a setup action. The nested selects look like the following: <nested:select property="selectedFont"> <nested:optionsCollection property="fonts" label="label" value="value" /> </nested:select> The action and prepopulate action are declared as so in the struts-config.xml: <action path="/watermarkJobDetailsSetup" type="com.wbsaw.struts.actions.WatermarkJobDetailsSetupAction" name="newWatermarkJobForm" validate="false" scope="request"> <forward name="setup.success" path="/WEB-INF/jsp/watermarkJobDetails.jsp"/> </action> <action path="/newWatermarkJob" type="com.wbsaw.struts.actions.WatermarkJobAction" name="newWatermarkJobForm" scope="request" input="/WEB-INF/jsp/watermarkJobDetails.jsp"> <forward name="newwmjob.submitok" path="/WEB-INF/jsp/testDone.jsp"/> </action> 9 html:text elements, each of these are backed by an String property in the ActionForm. 3 html:radio elements, these are backed by a single String object which represents which radio button was chosen. I'm not sure if this is the right way to handle radio buttons or not. Are you supposed to have a single String in your ActionForm to hold the value of which one was actually chosen? I declare them as follows in the jsp: <ul> <li><html:radio property="textLayout" value="center"/>Centered</li> <li><html:radio property="textLayout" value="staggered"/>Staggered</li> <li><html:radio property="textLayout" value="tiled"/>Tiled</li> </ul> 2 html:radio element, backed by a single String object. I have the same question about how I set these up as I did for the previous group of radio buttons. These are declared as follows: <ul> <li><html:radio property="textOrientation" value="toptobottom"/>Top To Bottom</li> <li><html:radio property="textOrientation" value="bottomtotop"/>Bottom To Top</li> </ul> -- http://www.quidprocode.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]