struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darren Karstens <darrenkarst...@gmail.com>
Subject Re: Problem with required validator
Date Tue, 05 Oct 2010 13:43:00 GMT
Thanks for the replies. I figured out what the problem was. My model
in the action class is a member variable called user, so I needed to
change the name of my form fields and validator fields to
user.userName instead of just userName.

2010/10/5 Raymond He <raymond.kk.he@gmail.com>:
> You can debug your app,and step in the required validator
> class'validation method. And check whether the value is populated .
> Maybe it'snull .
>
> 2010/10/5, Darren Karstens <darrenkarstens@gmail.com>:
>> Hi,
>> I have a xml validator for my user login action which requires values
>> for both the userName and password fields. However when submit the
>> form with these fields populated I still get the same "Username is
>> required" and "Password is required" messages. Am I right in thinking
>> that the "required" validator is triggered if no value is supplied for
>> the field? If thats the case why would it be triggered when I supply
>> values for those fields?
>>
>> Here is the validation xml file:
>>
>> <!DOCTYPE validators PUBLIC
>>         "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
>>         "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
>> <validators>
>>   <field name="userName">
>>       <field-validator type="required">
>>           <message>Username is required.</message>
>>       </field-validator>
>>   </field>
>>   <field name="password">
>>       <field-validator type="required">
>>           <message>Password is required.</message>
>>       </field-validator>
>>   </field>
>> </validators>
>>
>> Regards,
>> Darren
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> --
> 从我的移动设备发送
>
> *Kun He*  (or Raymond He)
> A Java Programmer
> Alibaba inc.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Mime
View raw message