Today is not my day! 整整一天调试一个Spring MVC的绑定request的parameter的问题。本来是个很简单的问题,就是把Request里的paramenter那出来。最基础最基础的问题了。但是在form里有一个上传文件的input [code lang="html"] <input type="text" name="businessDomain"/> <input type="file" name="version"/> [/code] Spring MVC 2.5 有简单的几种方法,获得request里的paramenter的方法,例如 [code lang="java"] protected ModelAndView checkinAndShow(@RequestParam("businessDomain") String businessDomain){ .... } [/code] 当request的方法为POST的时候,request里的paramenter就是空的,什么都得不到。翻来覆去的检查,连HTTP的header和内容都看了,确实发出去了阿。调试的时候web的request的参数始终为0。因为这次是用spring 2.5的annotation重构,以前的代码都是测试过得。由于问题出现在request中,这是最底层的问题了。估计出现在web.xml或者是spring的web bean的配置中。于是一步一步的回归到老的代码,终于发现了在spring的配置文件中少了 [code lang="xml"] <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- one of the properties available; the maximum file size in bytes --> <property name="maxUploadSize" value="100000" /> [...]
Posts tagged error
JPA create sql error
在创建entity的时候要注意entity的名字是否是对应的db的保留字 现在的开发中用到了lock这个entity,在persistence的时候出现错误: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Lock (lockOwner_UU ID, version_UUID, UUID) values (‘ff808181211ae76901211ae76c2c0′ at line 1 因为lock是mysql的保留字。 mysql的所有保留字可以在下面的网页里查到 http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
java.lang.ClassCastException
hibernate error msg, this could be the class doesn’t implement Serializable interface. Hibernates error msg is really hell !!