package controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping()
public class HelloController {
@RequestMapping(value = "/start", method = RequestMethod.GET)
public String startGet(@RequestParam
Date date) {
System.out.println(date.toString());
return "startGet";
}
@RequestMapping(value = "/aa", method = RequestMethod.POST)
public String startPose() {
return "startPost";
}
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(
dateFormat, false));
}
@RequestMapping("/hello")
public String hello() throws IOException {
String str = "<?xml version='1.0' encoding='UTF-8'?>" +
"<root label='haha'><child label='heihei'/></root>";
return null;
}
}