Spring mvc can';t使用MyEclipse IDE在spring mvc中将图像和文件存储和检索到数据库中
我正在使用spring mvc和MyEclipse IDE进行一个实时项目,而不集成maven,我的问题是如何将图像和文件存储和检索到数据库中。在数据库中存储图像文件的控制器代码:Spring mvc can';t使用MyEclipse IDE在spring mvc中将图像和文件存储和检索到数据库中,spring-mvc,Spring Mvc,我正在使用spring mvc和MyEclipse IDE进行一个实时项目,而不集成maven,我的问题是如何将图像和文件存储和检索到数据库中。在数据库中存储图像文件的控制器代码: @RequestMapping(value = "/saveproduct") public ModelAndView add(@ModelAttribute("command") CommonBean cbean, BindingResult result, HttpServletReq
@RequestMapping(value = "/saveproduct")
public ModelAndView add(@ModelAttribute("command") CommonBean cbean,
BindingResult result, HttpServletRequest request) throws Exception {
CommonsMultipartFile file = cbean.getImage();
System.out.println("file content is " + file);
cbean.setFile(file.getBytes());
ProductModel model = new ProductModel();
try {
BeanUtils.copyProperties(model, cbean);
eworldservice.addproduct(model);
} catch(Exception ex) {
ex.printStackTrace();
}
return new ModelAndView("home");
}