Hi guy,
First of all, i would to say "i,m not good in English and newbie spring".
I have a question about how to implement WebBindingInitializer.
Could you spend some time to help, i'm had read a spring3 document and focus on chapter 5, 15, 16 and search at this forums.
Now i try to render a screen show a human date (dd/MM/yyyy), i'm fail.


This code form some comment at expertexchange site.
Code:
package root.control;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.log4j.Logger;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.context.request.WebRequest;

public class GlobalBindingInitializer implements WebBindingInitializer {

	private static final Logger logger = Logger.getLogger(GlobalBindingInitializer.class);
	
	@Override
	public void initBinder(WebDataBinder webDataBinder, WebRequest webRequest) {
		logger.debug("AAAAAAAAAAAAAAAAAAAAAAAAAAAA");
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
		simpleDateFormat.setLenient(false);
		webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(simpleDateFormat, true));
		webDataBinder.registerCustomEditor(String.class, new StringTrimmerEditor(true));

	}
}

Code:
package root.control;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import root.model.Model;


@Controller
@RequestMapping("index.html")
public class MyController extends MultiActionController {

	private static final Logger logger = Logger.getLogger(MyController.class);

	@InitBinder
	@RequestMapping(method = RequestMethod.GET)
	public ModelAndView a(@ModelAttribute Model model, BindingResult bindingResult) throws Exception {
		logger.debug("TEST");
		model.setCurrentDate(new java.util.Date());
		bindingResult.getPropertyEditorRegistry();
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("index0");
		modelAndView.addObject(bindingResult.getModel());
		return modelAndView;
	}
	
	@RequestMapping(method = RequestMethod.POST)
	public String b(@ModelAttribute("model") Model model) {
		logger.debug("CCCCCCCCCCCCCCCCCCCCCCCCCCCCC");
		logger.debug(model.getCurrentDate());
		return "index2";
	}

}
Code:
package root.model;

public class Model {

	private java.util.Date currentDate;

	public java.util.Date getCurrentDate() {
		return currentDate;
	}

	public void setCurrentDate(java.util.Date currentDate) {
		this.currentDate = currentDate;
	}
}
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans
		http://www.springframework.org/schem...-beans-3.0.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context.xsd">
	
	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
		<property name="prefix" value="/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>
	
	<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
		<property name="cacheSeconds" value="0" />
		<property name="webBindingInitializer">
			<bean class="root.control.GlobalBindingInitializer" />
		</property>
	</bean>	
	
	<context:component-scan base-package="root.control" />

</beans>

index0
Code:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

</head>
<body>
INDEX0<br />
:<form:label path="model"/>:<br />
:<form:label path="model.currentDate"/>:<br />
${model}<br />
${model.currentDate}<br />
</body>
</html>

It show
Code:
INDEX0
::
::
root.model.Model@1ef9ca
Sat Mar 27 14:30:53 ICT 2010

What is my wrong.

thank you for any help.