Examples of CustomDateEditor


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 with non-existing value
    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());

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

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  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() {
      protected TagWriter createTagWriter() {
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

    @InitBinder
    private void initBinder(WebDataBinder binder) {
      binder.initBeanPropertyAccess();
      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

      assertEquals("2007-10-02", date);
      assertEquals(1, date2.length);
      assertEquals("2007-10-02", date2[0]);
      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

*/
public class CustomerBinding implements WebBindingInitializer {
  @Override
  public void initBinder(WebDataBinder binder, WebRequest request) {
    DateFormat dateFormat = new NumberDateFormat();
    binder.registerCustomEditor(Date.class, new CustomDateEditor(
        dateFormat, false));
    binder.registerCustomEditor(java.sql.Date.class, new CustomDateEditor(
        dateFormat, false));
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

   */
  protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    super.initBinder(request, binder);
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy H:m:s");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, false));   
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  private static final SimpleDateFormat outFmt = new SimpleDateFormat("dd.MM.");
  private static TimeZone timeZone = TimeZone.getTimeZone("CET");

  @InitBinder
  public void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) {
    binder.registerCustomEditor(Date.class, "eventDate", new CustomDateEditor(
        new SimpleDateFormat("yyyyMMddHHmm"), false));
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

     * of the right type.
     */
    private void configureFactory() {
        SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN, Locale.US);
        formatter.setTimeZone(TimeZone.getTimeZone("America/New_York"));
        CustomDateEditor dateEditor =
            new CustomDateEditor(formatter, true);
        registerCustomEditor(Date.class, dateEditor);
    }
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.