Unfortunately there is no sample validator plugin project for Struts on MyEclipseIde.com by example or similar project. I saw some mentions of the ValidatorPlugin but none of the suggested solutions fit and some of the links were broken as well.
(While I think of it I would like to suggest MyEclipseIde.com provide another section of the site for proven user/subscriber supplied working sample projects. )
In the meantime I am supplying my sample here
Note this problem I am having is with JDK 7 update 5
Perhaps once this problem is solved the sample will serve as simple sample of Apache Validator in MyEclipse and Struts 1.3 running on JDK 7 update 5 or you can try it on
JDK 6 update 33 the two safest(Secure) JDK versions available.
To both reproduce and possibly fix this sample case to a working state
[Please create a new Workspace and a new Web Project.
call it StrutsValidate and enter package: com.anonymous.struts
add Struts 1.3 capabilities
Copy and paste the webroot and src folders contained in the attached zip
file: StrutsValidatorPluginSample.zip attached please
and see if you can duplicate this problem.
I believe you can close MyEclipse and copy and paste the whole folder within the work space and project you created on top of the src and webroot folders respectively
I looked on the support forum pages but there were no working examples of this plugin. Maybe its deprecated but I have been very frustrated trying to get this to work in any way] I already went through the login tutorial and got that working but that does not use the Validator plugin namely, org.apache.struts.validator.ValidatorPlugIn
I have been trying to learn how to use a PlugIn Validator for Struts 1.3 Framework.
It is not working. This is a basic sample. I would really appreciate it if there was a tutorial on this or a resolution.
I saw other support forum entries which has me confused because I tried swapping out the DTD Doctypes for example for the two validator files which only made things worse.
and ultimately extracted the validator-rules.xml file from one of the Apache jar files and created a basic required and Double validator-rules.xml and appvalidation.xml both placed in my WEB-INF folder as you will see.
I have MyEclipse project files which may make the task of figuring what is wrong out easier
Basically this program adds a book object that is provided in a input form, alled add-new-book.jsp
and the Action object AddNewBook.java basically creates the object from the request input data and as I understand it the validator plugin is supposed to catch the input filter like and redirect to forwarding mapping or back to the same page and display the errors from a message file however I get a clean build and when
I invoke the Plugin by entering just the price field all the required rules of the validator appear to be ignored
while if I leave all fields blank I get the following exception:
un 24, 2012 11:57:03 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.7.0_05\bin;C:\Users\Rob\AppData\Local\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat\bin
Jun 24, 2012 11:57:03 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jun 24, 2012 11:57:03 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 204 ms
Jun 24, 2012 11:57:04 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 24, 2012 11:57:04 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.13
Jun 24, 2012 11:57:05 PM org.apache.struts.action.ActionServlet initChain
INFO: Loading chain catalog from jar:file:/C:/Users/Rob/Workspaces/StrutsV1.3c/.metadata/.me_tcat/webapps/Strutsch10/WEB-INF/lib/struts-core-1.3.8.jar!/org/apache/struts/chain/chain-config.xml
Jun 24, 2012 11:57:05 PM org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
Jun 24, 2012 11:57:05 PM org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/appvalidation.xml'
Jun 24, 2012 11:57:05 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jun 24, 2012 11:57:05 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jun 24, 2012 11:57:05 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/0 config=null
Jun 24, 2012 11:57:05 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1558 ms
Jun 24, 2012 11:57:23 PM org.apache.struts.chain.ComposableRequestProcessor init
INFO: Initializing composable request processor for module prefix ''
Jun 24, 2012 11:57:23 PM org.apache.commons.validator.ValidatorResources getForm
WARNING: Form 'BookForm' not found for locale 'en_US'
Jun 24, 2012 11:57:23 PM org.apache.struts.chain.commands.servlet.CreateAction createAction
INFO: Initialize action of type: com.anonymous.struts.AddBookAction
Jun 24, 2012 11:57:23 PM org.apache.struts.chain.commands.AbstractExceptionHandler execute
WARNING: Unhandled exception
java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1011)
at java.lang.Double.valueOf(Double.java:504)
at java.lang.Double.<init>(Double.java:597)
at com.anonymous.struts.AddBookAction.execute(AddBookAction.java:25)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:722)
Jun 24, 2012 11:57:23 PM org.apache.struts.chain.commands.ExceptionCatcher postprocess
WARNING: Exception from exceptionCommand 'servlet-exception'
java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1011)
at java.lang.Double.valueOf(Double.java:504)
at java.lang.Double.<init>(Double.java:597)
at com.anonymous.struts.AddBookAction.execute(AddBookAction.java:25)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:722)
Jun 24, 2012 11:57:23 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1011)
at java.lang.Double.valueOf(Double.java:504)
at java.lang.Double.<init>(Double.java:597)
at com.anonymous.struts.AddBookAction.execute(AddBookAction.java:25)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:722)
Please let me know if you can duplicate the problems I am seeing here |