本文进行对象的编辑和提交功能
对分类对象进行编辑和提交
操作思路
在CategoryMapper中增加sql语句
1
2
3
4
5
6
7
8
9<!-- 通过id获取Category对象 -->
<select id="get" resultType="Category">
select * from category where id = #{id}
</select>
<!-- 提交数据 -->
<update id="update" parameterType="Category">
update category set name = #{name} where id = #{id}
</update>在CategoryMapper/CategoryService/CategoryServiceImpl中增加get和update方法,代码略
在listCategory.jsp中增加edit的超链接。效果:网页上点击图标,进入admin_category_edit链接,并传入id
1
2
3
4
5
6<td>
<a href="admin_category_edit?id=${c.id}">
<span class="glyphicon glyphicon-edit"/>
</a>
</td>