用struts进行验证时无法进行invalid与email验证
ApplicationResources.properties文件内容errors.required={0} is not should be blank!
namelab=Name
errors.range={0} is not in the range {1} through {2}.
agelab=Age
errors.email={0} is an invalid e-mail address.
emailab=Email
errors.invalid={0} is invalid.
telab=Tel
validation.xml文件内容
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.
<form-validation>
<formset>
<form name="regForm">
<field property="uname" depends="required,mask">
<arg0 key="namelab"/>
<var>
<var-name>mask</var-name>
<var-value>[A-Za-z]</var-value>
</var>
</field>
<field property="age" depends="required,intRange">
<arg0 key="agelab"/>
<arg1 name="intRange" key="${var:min}" resource="false"/>
<arg2 name="intRange" key="${var:max}" resource="false"/>
<var>
<var-name>min</var-name>
<var-value>5</var-value>
</var>
<var>
<var-name>max</var-name>
<var-value>150</var-value>
</var>
</field>
<field property="email" depends="email">
<arg0 key="emailab"/>
</field>
<field property="tel" depends="required, mask">
<arg0 key="telab"/>
<var>
<var-name>mask</var-name>
<var-value>^\d{3}(-\d{8})?$</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
前台页面:
<%@ page language="java" pageEncoding="GB18030"%>
<%@ taglib uri="http://struts. prefix="bean"%>
<%@ taglib uri="http://struts. prefix="html"%>
<html>
<head>
<title>JSP for RegForm form</title>
</head>
<body>
<html:form action="/reg">
uname : <html:text property="uname"/><html:errors property="uname"/><br/>
sex : <html:text property="sex"/><html:errors property="sex"/><br/>
age : <html:text property="age"/><html:errors property="age"/><br/>
email : <html:text property="email"/><html:errors property="email"/><br/>
tel : <html:text property="tel"/><html:errors property="tel"/><br/>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>
错误信息:
java.lang.NoClassDefFoundError: org/apache/oro/text/perl/Perl5Util
org.(GenericValidator.java:65)
org.apache.struts.validator.FieldChecks.validateMask(FieldChecks.java:233)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.(ValidatorAction.java:544)
org.(Field.java:796)
org.(Field.java:876)
org.(Form.java:288)
org.(Validator.java:351)
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:116)
org.apache.struts.(ValidateActionForm.java:58)
org.apache.struts.(AbstractValidateActionForm.java:120)
org.apache.struts.(ActionCommandBase.java:51)
org.(ChainBase.java:190)
org.(LookupCommand.java:304)
org.(ChainBase.java:190)
org.apache.struts.(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
错误情况:能够进行required和intRange 但是email和mask验证 输入正确和错误都会显示上述错误