Yes, you must include validators.xml only if you change them - using
different set or adding your own

2013/9/22 Jose L Martinez-Avial <jlm...@gmail.com>:
> Lukasz, when you say he does no need validators.xml, I supose it is because 
> he is not using custom validators, right?
>
> Sent from my iPad
>
> On Sep 22, 2013, at 1:14 PM, Lukasz Lenart <lukaszlen...@apache.org> wrote:
>
>> Hi,
>>
>> Remove validators.xml - you don't need them. Can you post your whole page?
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>> 2013/9/21 Néstor Boscán <nestor.bos...@tcs.com.ve>:
>>> With the DTD solved the NullPointerException problem but I'm still not
>>> getting the javascript code that validates per field. My files are:
>>>
>>> LoginAction-validation.xml
>>> <!DOCTYPE validators PUBLIC
>>>        "-//Apache Struts//XWork Validator 1.0.3//EN"
>>>        "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd";>
>>> <validators>
>>>  <field name="username">
>>>    <field-validator type="required">
>>>      <message>El usuario es requerido</message>
>>>    </field-validator>
>>>  </field>
>>>  <field name="password">
>>>    <field-validator type="required">
>>>      <message>La contrasenia es requerida</message>
>>>    </field-validator>
>>>  </field>
>>> </validators>
>>>
>>> validators.xml
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <!DOCTYPE validators PUBLIC
>>>        "-//Apache Struts//XWork Validator Definition 1.0//EN"
>>>        "http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd";>
>>> <validators>
>>>    <validator name="required"
>>> class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
>>>    <validator name="requiredstring"
>>> class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
>>>    <validator name="int"
>>> class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
>>>    <validator name="long"
>>> class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/>
>>>    <validator name="short"
>>> class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
>>>    <validator name="double"
>>> class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
>>>    <validator name="date"
>>> class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
>>>    <validator name="expression"
>>> class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
>>>    <validator name="fieldexpression"
>>> class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/>
>>>    <validator name="email"
>>> class="com.opensymphony.xwork2.validator.validators.EmailValidator"/>
>>>    <validator name="url"
>>> class="com.opensymphony.xwork2.validator.validators.URLValidator"/>
>>>    <validator name="visitor"
>>> class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/>
>>>    <validator name="conversion"
>>> class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/>
>>>    <validator name="stringlength"
>>> class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/>
>>>    <validator name="regex"
>>> class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/>
>>>    <validator name="conditionalvisitor"
>>> class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/>
>>> </validators>
>>>
>>> The form tag has validate="true".
>>>
>>> When I generate the page I get:
>>>
>>> <script type="text/javascript">
>>>    function validateForm_login() {
>>>        var getFieldValue = function(field) {
>>>            var type = field.type ? field.type : field[0].type;
>>>            if (type == 'select-one' || type == 'select-multiple') {
>>>                return (field.selectedIndex == -1 ? "" :
>>> field.options[field.selectedIndex].value);
>>>            } else if (type == 'checkbox' || type == 'radio') {
>>>                if (!field.length) {
>>>                    field = [field];
>>>                }
>>>                for (var i = 0; i < field.length; i++) {
>>>                    if (field[i].checked) {
>>>                        return field[i].value;
>>>                    }
>>>                }
>>>                return "";
>>>            }
>>>            return field.value;
>>>        }
>>>        form = document.getElementById("login");
>>>        clearErrorMessages(form);
>>>        clearErrorLabels(form);
>>>
>>>        var errors = false;
>>>        var continueValidation = true;
>>>
>>>        return !errors;
>>>    }
>>> </script>
>>>
>>> Is like he's not detecting the fields
>>>
>>>
>>> On Fri, Sep 20, 2013 at 9:49 PM, JOSE L MARTINEZ-AVIAL 
>>> <jlm...@gmail.com>wrote:
>>>
>>>> It could be related to the DTD:
>>>>
>>>>
>>>> http://stackoverflow.com/questions/17144563/struts2-annotation-valiation-nullpointer-exception
>>>>
>>>>
>>>> 2013/9/20 JOSE L MARTINEZ-AVIAL <jlm...@gmail.com>
>>>>
>>>>> I assume you have an xml file to set the definitions, right? could you
>>>>> share it?
>>>>>
>>>>>
>>>>> 2013/9/20 Néstor Boscán <nesto...@gmail.com>
>>>>>
>>>>>> I've been trying to make Struts 2 JavaScript Validation work on WebLogic
>>>>>> 10.3.6. I first used 2.3.8 version and then the latest 2.3.15.2
>>>> version. I
>>>>>> still get the same error:
>>>>>>
>>>>>> java.lang.NullPointerException
>>>>>>        at
>>>>>> com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.lo
>>>>>> adFile(AnnotationActionValidatorManager.java:391)
>>>>>>        at
>>>>>> com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.bu
>>>>>> ildAliasValidatorConfigs(AnnotationActionValidatorManager.java:271)
>>>>>>
>>>>>> Any ideas?
>>>>>>
>>>>>
>>>>>
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to