Avatar of Econify
 asked on

Getting error while using Validation in Struts Application..

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.


Avatar of undefined
Last Comment

8/22/2022 - Mon

> <validator name="required"

in your validator-rules.xml try changing name="required to


sorry ignore my previous post. i think the issue is a different one

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

could you resolve the problem?

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy