Results 1 to 1 of 1
Thread: Commons validator
- 07-27-2007, 08:46 AM #1Member
- Join Date
- Jul 2007
- Rep Power
I am trying to use this framework for a web project, which uses ajax validation for fields triggered by onChange event on client side.
According to this I can post to the server only the formname,fieldname and the value parameters.
I spent a lot of time to find out how should I configure the validator object to the validate a String or an Intiger instead of a bean.
I copied the code base from the example shipped with commons validator source so I think that the most part of code and configuration files are OK.
The example name of the form field is age so I initialized the validator in this way :
Validator validator = new Validator(resources, "ValidateBean", "age");
and use this code to pass the value to validate :
validator.setParameter(Validator.FIELD_PARAM, %String or Integer or whatever% );
Always got the result message that age parameter is required.
I even tried to debug what does it do, and it seemed that validator is works only for beans.
Are there any way to validate simple values (not beans) with commons validator?
- By Ed in forum Advanced JavaReplies: 3Last Post: 07-25-2011, 03:19 PM
- By Joe2003 in forum Advanced JavaReplies: 0Last Post: 02-07-2008, 05:23 PM
- By zrrbite in forum Advanced JavaReplies: 0Last Post: 12-14-2007, 12:47 PM
- By JavaBean in forum Java SoftwareReplies: 0Last Post: 10-02-2007, 04:13 PM
- By Felissa in forum Web FrameworksReplies: 1Last Post: 07-06-2007, 04:39 PM