java400报错

来源:互联网 发布:知乎 日本整容 编辑:程序博客网 时间:2024/06/09 14:27

页面报400,控制台没输出也没报错,原来是数据库中的date类型,和实体的字段冲突。


获取到页面的时间,转换成date类型,在给实体date类型属性赋值。

报has an unsupported return type: class java.lang.String===》在dao层写add方法时,疏忽了,写了String的返回类型

import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.List;import java.util.Map;import javax.servlet.http.HttpServletResponse;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.servlet.ModelAndView;import com.six.model.In_out_come;import com.six.service.InOutService;import com.six.utils.LogerUtil;import com.six.utils.Pagenation;@Controllerpublic class InOutController {@Autowiredprivate InOutService ios;@RequestMapping("/getAllInOut")public ModelAndView getAllInOut(@RequestParam(defaultValue = "1") int page, HttpServletResponse re) {// try {// re.getWriter().println("<script>alert('OK,呵呵')</script>");// } catch (IOException e) {// // TODO Auto-generated catch block// e.printStackTrace();// }ModelAndView mm = new ModelAndView("html/right2ffy");int count = ios.getInOutCount();int pageNuM = 0;page = Pagenation.judgePage(page, count, pageNuM);int page1 = (page-1)*2;//拼接sql分页List<Map<String, Object>> list = ios.getAllInOut(page1);mm.addObject("list", list);mm.addObject("page", page);mm.addObject("count", count);LogerUtil.logMessage("收支流水信息:" + list);return mm;}@RequestMapping("/addinout")public String addinout(In_out_come inout, String date) throws ParseException { //获取页面dateSystem.out.println(date);SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");inout.setIn_made_date(sdf.parse(date));                        //转为date类型try {ios.addinout(inout);LogerUtil.logMessage("新增成功");} catch (Exception e) {// TODO: handle exceptionLogerUtil.logerror(e.toString());}return "redirect:getAllInOut.do";}}


400报错!

原创粉丝点击