Package org.springframework.beans.propertyeditors

Examples of org.springframework.beans.propertyeditors.CustomDateEditor


    public void initBinder(WebDataBinder binder, @PathVariable("hotel") String hotel) {
      assertEquals("Invalid path variable value", "42", hotel);
      binder.initBeanPropertyAccess();
      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
      dateFormat.setLenient(false);
      binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    }
View Full Code Here


    // first set up the pagecontext and the bean
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
    CustomDateEditor l = new CustomDateEditor(df, true);
    binder.registerCustomEditor(Date.class, l);
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());

    // execute the bind tag using the date property
    BindTag bind = new BindTag();
View Full Code Here

    // first set up the PageContext and the bean
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
    CustomDateEditor l = new CustomDateEditor(df, true);
    binder.registerCustomEditor(Date.class, l);
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());

    // try another time, this time using Strings
    BindTag bind = new BindTag();
View Full Code Here

    // first set up the pagecontext and the bean
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
    CustomDateEditor l = new CustomDateEditor(df, true);
    binder.registerCustomEditor(Date.class, l);
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());

    // now try to execute the tag outside a bindtag
    TransformTag transform = new TransformTag();
View Full Code Here

    // first set up the pagecontext and the bean
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
    CustomDateEditor l = new CustomDateEditor(df, true);
    binder.registerCustomEditor(Date.class, l);
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());

    // try with non-existing value
    BindTag bind = new BindTag();
View Full Code Here

    // first set up the pagecontext and the bean
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
    CustomDateEditor l = new CustomDateEditor(df, true);
    binder.registerCustomEditor(Date.class, l);
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());

    // execute the bind tag using the date property
    BindTag bind = new BindTag();
View Full Code Here

  public void testNestingInFormTag() throws JspException {
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
    CustomDateEditor l = new CustomDateEditor(df, true);
    binder.registerCustomEditor(Date.class, l);
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());

    FormTag formTag = new FormTag() {
      @Override
View Full Code Here

    public void initBinder(WebDataBinder binder, @PathVariable("hotel") String hotel) {
      assertEquals("Invalid path variable value", "42", hotel);
      binder.initBeanPropertyAccess();
      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
      dateFormat.setLenient(false);
      binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    }
View Full Code Here

  private static class Handler {

    @InitBinder("dateParam")
    public void initBinder(WebDataBinder dataBinder, @RequestParam("datePattern") String datePattern) {
      SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern);
      dataBinder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    }
View Full Code Here

    @InitBinder
    private void initBinder(WebDataBinder binder) {
      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
      dateFormat.setLenient(false);
      binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.propertyeditors.CustomDateEditor

Copyright © 2018 www.massapicom. 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.