备忘
文章平均质量分 53
StevenSHC
这个作者很懒,什么都没留下…
展开
-
Spring框架,使用ModelMap传值,jsp无法获取!
原controller中的代码片段:@RequestMappingpublic String sayHi() { ModelMap model = new ModelMap(); model.addAttribute("message", "Hello there!"); return "hello";}jsp页面代码(hello.jsp):<%@ pa原创 2014-02-26 01:19:00 · 9296 阅读 · 6 评论 -
关于Spring MVC Interceptor的设置顺序
一定要让最基础的Interceptor在最前(e.g.BaseInterceptor)。恩,就是这样!!!原创 2015-04-04 23:15:33 · 670 阅读 · 0 评论 -
Mybatis对有可能返回empty set的数据库查询结果进行操作
举个栗子我有一个用户 user 表,表中只有 id(int) 和 name(String) 字段(别在意细节),值都是唯一的。现在我要注册一个新的用户,肯定先要检查要注册的用户名是否存在。那用 mybatis 该怎么做呢。首先 mapper 中写sql:SELECT id FROM user WHERE name='lalala'然后就是要配置传入和返回的数据类型par原创 2015-04-06 20:45:43 · 3301 阅读 · 0 评论 -
mybatis 传递多参数(不使用实体)
在使用mybatis传入多参数对数据库进行操作时,如更新DAO接口:public int update(int id,String name);Mapper配置: UPDATE user SET name=#{name} WHERE id=#{id}上述会返回如 Parameter 'id' not found. Available parameters are [0, pa转载 2015-04-07 14:44:08 · 1161 阅读 · 0 评论