package com.design.base.utils;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
public abstract class BaseController {
protected static final String JSP_MESSAGE = "jsp/message";
protected HttpServletRequest request;
protected HttpServletResponse response;
protected HttpSession session;
protected ServletContext application;
@ModelAttribute
public void setServletAPI(HttpServletRequest request,HttpServletResponse response){
this.request = request;
this.response = response;
this.session = request.getSession();
this.application = this.session.getServletContext();
}
@InitBinder
public void initDate(WebDataBinder dataBinder){
dataBinder.registerCustomEditor(Date.class , new PropertyEditorSupport(){
@Override
public void setAsText(String text ) throws IllegalArgumentException {
setValue(DateHelper.parseDate(text));
}
});
}
}
最近下载更多
最近浏览更多
dddding yang LV6
9月15日
wlax99 LV12
2月17日
lz88888 LV12
2024年10月17日
Zyy19820821 LV2
2024年9月16日
lingtiejing LV15
2024年6月28日
sunlea LV20
2024年6月23日
gejun666 LV1
2024年6月18日
lilitu LV6
2024年5月29日
李俊雄 LV3
2024年5月8日
WaZiN7 LV6
2024年4月25日

