Package javango.contrib.hibernate

Examples of javango.contrib.hibernate.ModelForm.bind()


      context.put("form_url", String.format("%s/%s", request.getContext(), request.getPath()));
     
      Map<String, String[]> searchParams = new HashMap<String, String[]>(request.getParameterMap());
      if (searchParams.containsKey("page")) searchParams.remove("page");
      if (searchParams.containsKey("prompt_data")) searchParams.remove("prompt_data");
      form.bind(request.getParameterMap());
      if (form.isValid()) {
        int page;
        try {
          page = new Integer(request.getParameter("page"));
        } catch (NumberFormatException e) {
View Full Code Here


    m.put("sender", new String[] {"100"});
    m.put("ccMyself", new String[] {"false"});
       
    ModelForm contactForm = new ModelForm(fieldFactory, hibernateUtil, managers);
    contactForm.setModel(ContactBean.class);
    contactForm.bind(m);
    assertFalse(HibernateFormHelper.isValid(contactForm, ContactBean.class));
    Map<String, String> errors = contactForm.getErrors();
    assertTrue(errors.containsKey("value"));
    assertEquals("value must be between 4 and 10", errors.get("value"));
    assertTrue(errors.containsKey("subject"));
View Full Code Here

    m.put("subject", new String[] {"1234567890123456789012"});
    m.put("sender", new String[] {"100"});
    m.put("ccMyself", new String[] {"false"});
       
    ModelForm contactForm = new ContactForm(fieldFactory, hibernateUtil, managers);
    contactForm.bind(m);
    assertFalse(contactForm.isValid());
    Map<String, String> errors = contactForm.getErrors();
    assertTrue(errors.containsKey("sender"));
   
    m.put("sender", new String[] {"foo@example.com"});
View Full Code Here

    Map<String, String> errors = contactForm.getErrors();
    assertTrue(errors.containsKey("sender"));
   
    m.put("sender", new String[] {"foo@example.com"});
    contactForm = new ContactForm(fieldFactory, hibernateUtil, managers);
    contactForm.bind(m);
    assertFalse(contactForm.isValid());
    errors = contactForm.getErrors();
    assertTrue(errors.containsKey("value"));
    assertEquals("value must be between 4 and 10", errors.get("value"));
    assertTrue(errors.containsKey("subject"));
View Full Code Here

    assertTrue(errors.containsKey("subject"));
    assertEquals("length must be between 0 and 20", errors.get("subject"));
   
    m.put("sender", new String[] {"12345678901234567890foo@example.com"});
    contactForm = new ContactForm(fieldFactory, hibernateUtil, managers);
    contactForm.bind(m);
    assertFalse(contactForm.isValid());
    errors = contactForm.getErrors();
    assertTrue(errors.containsKey("sender"));
    assertEquals("length must be between 0 and 20", errors.get("sender"));
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.