Results 1 to 2 of 2

Thread: how to bind calender field in the model

  1. #1
    Join Date
    Nov 2005
    Posts
    148

    Question how to bind calender field in the model

    Hi,

    i m trying to bind date value (using calender). i am setting the field value through java script. value is set correctly, but never set in the bind model property. whereas other binded values r binded correctly.

    Thanx in advance.

    Shahzad

  2. #2
    Join Date
    Aug 2004
    Location
    The Netherlands
    Posts
    160

    Default

    Not sure if this is what you mean, hope it helps

    Code:
    protected void initBinder(HttpServletRequest request,
    			ServletRequestDataBinder binder) throws Exception {
    	SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
    	dateFormat.setLenient(false);
    	binder.registerCustomEditor(Date.class,null,
    			new CustomDateEditor(dateFormat,true));
    }
    Jettro Coenradie
    http://www.gridshore.nl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •