Hi,
I am validating a condition : Input should not contain any of these
characters &,",<,>,%,(,)
And to achieve this my RegEx is : ^[^(\&|"|<|>|%|\(|\))]+$
Also here is my code snippet from validation.xml:
<constant>
<constant-name>noSpecialCharacters</constant-name>
<constant-value>^[^(\&|"|<|>|%|\(|\))]+$</constant-value>
</constant>
But, when i add the above element to validation.xml, I get following error
message in my sandbox logs(Tomcat 5.5):
Nov 7, 2007 3:59:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet action as unavailable
Nov 7, 2007 3:59:41 PM org.apache.catalina.core.StandardContext
loadOnStartup
SEVERE: Servlet /AnotherEntrCoun 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:171)
at
org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:884)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:356)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4225)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1190)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
at java.lang.Thread.run(Thread.java:595)
One of the many tests, i did to prove that the above error is 'indeed'
because of the REGEX, i tried substituing it with following code in
validation.xml with:
<constant>
<constant-name>noSpecialCharacters</constant-name>
<constant-value>>.</constant-value>
</constant>
This time, my container does complain. My container is also happy when i
remove the problematic code completely.
I also tried to validate my REGEX -start ^[^(\&|"|<|>|%|\(|\))]+$ end- with
a 'java.util.regex' based validator, It works the way, it is supposed to.
Here is the link of the validator
"http://www.fileformat.info/tool/regex.htm", used by me.
It can well turn out to be a simple issue, please help me in getting it to
work.
.H
--
View this message in context:
http://www.nabble.com/-S1.3-Strange-problem-with-validation.xml%27s-Regex-tf4768238.html#a13638956
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]