posted 8 years ago
Hi,
I am new to struts (1.2) and facing problem in applying validator framework. When I am adding :
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
to my struts-config.xml and starting Tomcat server, it is giving me following error:
INFO: Marking servlet action as unavailable
Jun 18, 2009 12:07:54 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /ParvatiHandicraft threw load() exception
javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:172)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Unknown Source)
My project was missing commons-validator.jar so I downloaded it and put it in my application, but still I'm facing the same problem.
Please help me, as without solving this I cannot move forward in my project.
Thanks in Advance.
I am new to struts (1.2) and facing problem in applying validator framework. When I am adding :
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
to my struts-config.xml and starting Tomcat server, it is giving me following error:
INFO: Marking servlet action as unavailable
Jun 18, 2009 12:07:54 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /ParvatiHandicraft threw load() exception
javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:172)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Unknown Source)
My project was missing commons-validator.jar so I downloaded it and put it in my application, but still I'm facing the same problem.
Please help me, as without solving this I cannot move forward in my project.
Thanks in Advance.
Namrta Pandey
Ranch Hand
Posts: 36
Namrta Pandey
Ranch Hand
Posts: 36
posted 8 years ago
Thanks David, it was some problem with DTD specification in validation.xml. But now page is coming fine but it is not validating the fields. For example in a textbox i have applied required validation, but it is going to the action without showing any message even if i am not entering any values.
This is my form :
login.jsp
validation.xml
Please tell me where I am going wrong.
This is my form :
login.jsp
validation.xml
Please tell me where I am going wrong.
posted 8 years ago
Please UseCodeTags; without them it's difficult to read code and configuration.
We'll also need to see the configuration for both the action and form bean.
We'll also need to see the configuration for both the action and form bean.
Namrta Pandey
Ranch Hand
Posts: 36
Namrta Pandey
Ranch Hand
Posts: 36
posted 8 years ago
HI,
I have resolved the problem.
I removed validate method from my form bean.
after doing this validation messages were displaying like this:
Then I replaced
from validator.xml by
and it worked.
Though it worked, I don't know the reason of removing validate method from my form bean, If anybody has any idea please guide me.
Also now as it is working with validation.xml but while showing ActionMessages in JSP, it is printing the meassage with ???en_US.... :
In my action class :
My JSP when i tried this :
It didn't work, as in it was not showing me any error message so i replaced it with :
Now it's printing the error message like :
Please help me to solve this problem. And also let me know why <bean:messages...> is not working.
Thanks in advance.
Namrta
I have resolved the problem.
I removed validate method from my form bean.
after doing this validation messages were displaying like this:
Then I replaced
from validator.xml by
and it worked.
Though it worked, I don't know the reason of removing validate method from my form bean, If anybody has any idea please guide me.
Also now as it is working with validation.xml but while showing ActionMessages in JSP, it is printing the meassage with ???en_US.... :
In my action class :
My JSP when i tried this :
It didn't work, as in it was not showing me any error message so i replaced it with :
Now it's printing the error message like :
Please help me to solve this problem. And also let me know why <bean:messages...> is not working.
Thanks in advance.
Namrta
