作者: liubin 日期: 2010年07月08日  分类:技术  Comments Off 
spring里的ModelAttribute
在spring里,model和form的对应不需要写xml文件,只需要在页面里用form这个taglib就可以了: email 这里的commandName就是和Controller里相互映射的model的名字(实例名) path=email指定了对应对象的属性。 Controller里可以这样写: protected ModelAndView sendInvite(@ModelAttribute(“invite”) Invite invite, BindingResult result, SessionStatus status, ModelMap model) {} 其中,参数的第一个invite会自动从form里生成一个Invite的实例并设置值,Controller里直接使用这个对象就可以。 而加上@SessionAttributes的话,可以在form里一直...
578 days前 / 0 次浏览阅读全文
作者: liubin 日期: 2010年07月01日  分类:技术  Comments Off 
svn不能提交的错误
Eclipse里提交代码的时候,提示: org.tigris.subversion.javahl.ClientException: APR does not understand this error code svn: Commit failed (details follow): svn: Cannot accept non-LF line endings in ‘svn:log’ property comment写了2行而已,查了下,网上有人说每行最后以空格结尾就行了,我试了下还是不行。 不要comment,提交成功。。。奇怪。
585 days前 / 0 次浏览阅读全文
作者: liubin 日期: 2010年07月01日  分类:技术  Comments Off 
在spring中设置request的charset为utf-8
在java里可以用:request.setCharacterEncoding(“UTF-8″); 在Spring的Controller类里个别设置太麻烦,可以用filter <filter-name>Spring character encoding filter</filter-name>         <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>         <init-param>             <param-name>encoding</param-name>             <param-value>utf-8</param...
585 days前 / 0 次浏览阅读全文