这是我的controller:
@RequestMapping("/editFabricSubmit")
public String editFabricSubmit(HttpServletRequest request,
Fabric fabric,
MultipartFile fabric_pic) throws Exception{
String originalFilename = fabric_pic.getOriginalFilename();
if(fabric_pic!=null && originalFilename!=null && originalFilename.length()>0){
String pic_path = "D:\\pic\\";
String newFileName = UUID.randomUUID() + originalFilename.substring(originalFilename.lastIndexOf("."));
File newFile = new File(pic_path+newFileName);
fabric_pic.transferTo(newFile);
fabric.setPic(newFileName);
}
fabricService.updateByPrimaryKeySelective(fabric);
return "success";
这是我的po:
private Integer id;
private String name;
private String compositions;
private Double baseprice;
private String yarncount;
private String density;
private String weight;
private String width;
private String pic;
private String supplierno;
private Double restmeter;
这是我的mapper.
<update id="updateByPrimaryKeySelective" parameterType="textile.ssm.po.Fabric" >
update fabric
set name = #{name,jdbcType=VARCHAR},
compositions = #{compositions,jdbcType=VARCHAR},
baseprice = #{baseprice,jdbcType=DOUBLE},
yarncount = #{yarncount,jdbcType=VARCHAR},
density = #{density,jdbcType=VARCHAR},
weight = #{weight,jdbcType=VARCHAR},
width = #{width,jdbcType=VARCHAR},
pic = #{pic,jdbcType=VARCHAR}
id = #{id,jdbcType=INTEGER},
restmeter = #{restmeter,jdbcType=DOUBLE},
where supplierno = #{supplierno,jdbcType=INTEGER}
为什么一直显示
there is no ** getter for property named 'technics' in 'class textile.ssm.po.Fabric'
PS. jsp页面里面也没有这个technics
在测试时报错:There is no getter for property named'tj' in 'class java.lang.String'
问题分析:Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取string.tj值,引起报错。
解决方法: public ListmethodName(@Param(value="tj") String tj);说明参数......
答案就在这里:Mybatis-There is no getter for property named 'tj' in 'class
----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。
在测试时报错:There is no getter for property named'tj' in 'class java.lang.String'
问题分析:Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取string.tj值,引起报错。
http://blog.csdn.net/ldl22847/article/details/46836913
把jdbcType全去掉
比如:
UPDATE aaa set
first=#{first},second=#{second},third=#{third}
where id=#{id}
类型可以自动匹配
首先class textile.ssm.po.Fabric确实没有属性名为technics的get/set方法。这个technics应该不是你要的字段。你需要看看你的页面上是不是有什么控件name的名字是technics,导致说传到后台自动解析成这个Fabric对象的属性了,这需要小心的去查错。firebug看看urlpost了什么参数
居然是eclipse的缓存问题,