参数传递给模板
1.
@RequestMapping(path = {"/home/{userId}"}, method = {RequestMethod.GET})
public String index(@PathVariable("userId") int userId)
2.
public String index(
@RequestParam(value = "type", defaultValue = "1") int type,
@RequestParam(value = "key",required = true) String key)
3.
public String template(Model model) {
model.addAttribute(user);
}
dao层通过xml实现
位置
语法
<mapper namespace="com.nowcoder.dao.QuestionDAO">
<select id="selectLatestQuestions" resultType="com.nowcoder.model.Question">
</select>
</mapper>