Examples of CustomDateEditor


Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  public void testCustomDateEditorWithAllowEmpty() throws Exception {
    final DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.GERMAN);
    TestController mc = new TestController() {
      protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) {
        binder.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
      }
    };

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/welcome.html");
    request.addParameter("date", "1.5.2003");
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  public void testCustomDateEditorWithoutAllowEmpty() throws Exception {
    final DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.GERMAN);
    TestController mc = new TestController() {
      protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) {
        binder.registerCustomEditor(Date.class, new CustomDateEditor(df, false));
      }
    };

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/welcome.html");
    request.addParameter("date", "1.5.2003");
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

 
  public void testWithCustomDateEditor() throws Exception {
    final DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
    TestController tc = new TestController() {
      protected void initBinder(PortletRequest request, PortletRequestDataBinder binder) {
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
      }
    };
    MockRenderRequest request = new MockRenderRequest();   
    MockRenderResponse response = new MockRenderResponse();
    String name = "test";
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

    MockPortletRequest request = new MockPortletRequest();
    request.addParameter("date", "06-03-2006");

    PortletRequestDataBinder binder = new PortletRequestDataBinder(bean);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    binder.bind(request);

    assertEquals(expected, bean.getDate());
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

    @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

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

    @SuppressWarnings("unused")
    @InitBinder({"myCommand", "date"})
    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

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

    public void initBinder(WebDataBinder binder, WebRequest request) {
      assertNotNull(request.getLocale());
      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
      dateFormat.setLenient(false);
      binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

    // 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

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

    // 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

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

    // 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
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.