troubleshooting Question

Getting error while using Validation in Struts Application..

Avatar of Econify
Econify asked on
4 Comments1 Solution657 ViewsLast Modified:
Hi all,

I am getting a very strange, intermittent error. While
modifying or adding forms and actions, my app will be
running fine. But when I am trying to use Client-side validation into my application, I am getting following error:-
"org.apache.jasper.JasperException: Depends string "required" was not found in validator-rules.xml."

Follwin are entries in Struts config.xml file:-
      <message-resources parameter="com.econify.struts.ApplicationResources" />
      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
            <set-property property="pathnames"
    /WEB-INF/validation.xml" />
My content of validation.xml file is:-
    <form name="userForm">
      <field property="username"
        <arg0 key="userRegistration.username.null"/>
& validator-rules.xml file is:-
    <validator name="required"

            function validateRequired(form) {
                var isValid = true;
                var focusField = null;
                var i = 0;
                var fields = new Array();
                oRequired = new required();
                for (x in oRequired) {
                      var field = form[oRequired[x][0]];
                    if (field.type == 'text' ||
                        field.type == 'textarea' ||
                        field.type == 'file' ||
                        field.type == 'select-one' ||
                        field.type == 'radio' ||
                        field.type == 'password') {
                        var value = '';
                                    // get field's value
                                    if (field.type == "select-one") {
                                          var si = field.selectedIndex;
                                          if (si >= 0) {
                                                value = field.options[si].value;
                                    } else {
                                          value = field.value;
                        if (trim(value).length == 0) {
                              if (i == 0) {
                                  focusField = field;
                              fields[i++] = oRequired[x][1];
                              isValid = false;
                if (fields.length > 0) {
                return isValid;
            // Trim whitespace from left and right sides of s.
            function trim(s) {
                return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );

& in one of my jsp file I am using "userForm" formbean in which I am writing following for using Claient side validation.
<html:javascript formName="userForm"/>
Why I am getting this error? PLease help me.
Thank you.


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros