Hi,

if you prefer to use JSR 303 Bean Validation (it's very similar to Hibernate
Validator, in fact, it is the reference implementation), I made a blog post
about how to integrate it with Wicket:

http://carinae.net/2009/12/integration-of-jsr-303-bean-validation-standard-and-wicket-1-4/


On Mon, Jan 4, 2010 at 11:28 AM, ayman elwany <aymanelw...@gmail.com> wrote:

> thanks Martin for the link , I used it but I had a problem;
>
>
> public class CarPage extends WebPage {
>
> *               ......*
> *               ......*
>                UserModel user=  ((LoginSession)getSession()).getUserBean();
>  *              ......*
> *                ......*
> *               ......*
> private void fillPersonalInfoComponents(Form personalForm) {
>  *           ......*
>  *           ......   *
>                PropertyModel fullnamepropertyModel =new
> PropertyModel<String>(user, "fullNameValue");
> fullName = new TextField("fullName", fullnamepropertyModel);
>  personalForm.add(fullName);
> //System.out.println("Model =
> "+fullnamepropertyModel.getChainedModel().getClass().getName());
> fullName.add(new HibernateValidator<String>(fullnamepropertyModel,
> "fullNameValue"));
>
>  }
> }
>
>
>
> And the user model is
>
> public class UserModel implements Serializable {
>
> /**
>  *
>  */
> private static final long serialVersionUID = 1011452297289823651L;
>        *       ......*
> *               ......*
> *               ......*
>
> @NotNull
> @NotEmpty
> private String fullNameValue;
>    *           ......*
> *               ......*
> *               ......*
> }
>
>
> but it always fails and gives me that my model is null .  but the strange
> behaviour that when I changed  HibernateValidator constructor
>
> *from*
>
> public HibernateValidator(I*Model entityModel*, String property) {
> this.property = property;
> if (entityModel != null)
> hibernateValidator = new
> ClassValidator(*entityModel.getObject().getClass()*
> );
> }
>
>
> *TO*
> public HibernateValidator(*Object bean, *String property) {
> this.property = property;
> //if (entityModel != null)
> hibernateValidator = new ClassValidator(*bean.getClass()*);
> }
>
> and did this
>
> fullName.add(new HibernateValidator<String>(user, "fullNameValue"));
>
> the validation worked *fine *!!!
>
> so is there is any problem in the propertymodel with hibernate validator???
>
> On Mon, Jan 4, 2010 at 8:37 AM, Martin Makundi <
> martin.maku...@koodaripalvelut.com> wrote:
>
> > http://42lines.net/content/integrating-hibernate-validator-and-wicket
> >
> > 2010/1/4 ayman elwany <aymanelw...@gmail.com>:
> > > Hi,
> > >
> > > Is there any common practice to integrate wicket with hibernate
> validator
> > ?
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>

Reply via email to