学习springmvc的第十天(保存)

1、在昨天的基础上把实体类中创建带参、无参的构造方法;

2、在controller中创建一个获取所有开销、和保存开销的方法;

学习springmvc的第十天(保存)

3、在list.jsp新加一个请求,通过后天跳转到增加页面;

学习springmvc的第十天(保存)

4、在view下新建一个input.jsp在其中导入springmvc的form表达式;

学习springmvc的第十天(保存)

学习springmvc的第十天(保存)学习springmvc的第十天(保存)学习springmvc的第十天(保存)

其中碰到的问题:

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute

是因为从list页面到input页面之间需要一个对象来展示信息(后台定义了一个空的对象,再在input.jsp的form表中设置了modelAttribute指向它);

 Could not instantiate property type:是因为实体类没有创建无参的构造函数;