王逍遥这是我们的狗 2017-12-31 04:38 采纳率: 0%
浏览 3549
已结题

Parameter 'xxx' not found.

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'title' not found. Available parameters are [1, 0, param1, param2]
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy24.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:254)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:54)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy32.updateItemsById(Unknown Source)
at com.taotao.service.impl.ItemServiceImpl.updateItems(ItemServiceImpl.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
这是异常,下面开始上代码,一个简单的更新操作.

Tbitem和继承类ItemCustom:
 public class ItemCustom extends TbItem{

}
 public class TbItem {
    private Long id;

    private String title;

    private String sellPoint;

    private Long price;

    private Integer num;

    private String barcode;

    private String image;

    private Long cid;

    private Byte status;

    private Date created;

    private Date updated;

        //省略get/set方法
UpdateMapper.xml
 <mapper namespace="com.taotao.mapper.UpdateMapper">
    <update id="updateItemsById" parameterType="com.taotao.wto.ItemCustom">

          UPDATE tb_item SET title = '#{title}',price = #{price},num = #{num} WHERE id = #{id} 

    </update>
</mapper>

mapper接口:

 public interface UpdateMapper {
    ItemCustom updateItemsById(Long id,ItemCustom itemCustom);
}

service层的代码:

    @Override
    public void updateItems(Long id, ItemCustom itemCustom) {
        updateMapper.updateItemsById(id, itemCustom);
    }

controller:

//更新商品,提交商品更新信息
    @RequestMapping("/editItemsSubmit")
    public String editItemsSubmit(Long id,ItemCustom itemCustom){
        itemService.updateItems(id, itemCustom);
        return "success";
    }

最后是editItems.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改商品信息</title>

</head>
<body> 
<!-- submit后,表单提交到此action路径 -->
<form id="itemForm" action="${pageContext.request.contextPath }/editItemsSubmit.action" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="${itemCustom.id }"/>
修改商品信息:
<table width="100%" border=1>
<tr>
    <td>商品名称</td>
    <td><input type="text" name="title" value="${itemCustom.title }"/></td>
</tr>
<tr>
    <td>商品价格</td>
    <td><input type="text" name="price" value="${itemCustom.price }"/></td>
</tr>
<tr>
    <td>商品数量</td>
    <td><input type="text" name="num" value="${itemCustom.num}"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="提交"/>
</td>
</tr>
</table>

</form>
</body>

</html>

求帮忙看看问题在哪,谢谢。

  • 写回答

5条回答 默认 最新

  • alexjohnny19870918aa 2017-12-31 05:09
    关注

    TbItem的属性直接做成public修饰

    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站