use of org.springframework.web.bind.annotation.InitBinder in project webapp by elimu-ai.
the class ImageCreateController method initBinder.
/**
* See http://www.mkyong.com/spring-mvc/spring-mvc-failed-to-convert-property-value-in-file-upload-form/
* <p></p>
* Fixes this error message:
* "Cannot convert value of type [org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile] to required type [byte] for property 'bytes[0]'"
*/
@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws ServletException {
logger.info("initBinder");
binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor());
}
use of org.springframework.web.bind.annotation.InitBinder in project webapp by elimu-ai.
the class ImageEditController method initBinder.
/**
* See http://www.mkyong.com/spring-mvc/spring-mvc-failed-to-convert-property-value-in-file-upload-form/
* <p></p>
* Fixes this error message:
* "Cannot convert value of type [org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile] to required type [byte] for property 'bytes[0]'"
*/
@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws ServletException {
logger.info("initBinder");
binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor());
}
use of org.springframework.web.bind.annotation.InitBinder in project dq-easy-cloud by dq-open-cloud.
the class DqBaseController method initBinder.
@InitBinder
public void initBinder(WebDataBinder webDataBinder) {
DateFormat dateFormat = new SimpleDateFormat(DqDateFormatUtils.FORMAT_NORMAL_DAY);
webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
// webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat(DqDateFormatUtils.FORMAT_NORMAL), true));
}
use of org.springframework.web.bind.annotation.InitBinder in project production_ssm by megagao.
the class FCountCheckController method InitBinder.
@InitBinder
public void InitBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, true));
}
use of org.springframework.web.bind.annotation.InitBinder in project portal by ixinportal.
the class BillWebController method initBinder.
@InitBinder
public void initBinder(WebDataBinder binder) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
CustomDateEditor dateEditor = new CustomDateEditor(df, true);
binder.registerCustomEditor(Date.class, dateEditor);
}
Aggregations