就首次ssm整合后简单分页出现的问题(目前没接触过前端,pagehelper不了解)
1.一开始想传入参数但是不知道怎么样通过页面转发获取
<a href=“index.jsp?cpage=i”>i</a>
感觉带参数再进行转发就十分麻烦了
注index.jsp 是selectAll
2紧接着就是相对路径的问题
今天在这上面花费了不少时间,实在是惭愧
<% pageContext.setAttribute("ctp",request.getContextPath());
%>
之前不了解,现在才了解了,一定要加上{ctp}
3 jsp语法问题
是之前没认真学的原因,忘记的最基础的语法格式
后来一直瞎改 ,害 真的是菜得吃88
<% for( int i =1;i<=page;i++ ){%>
<a href="${ctp}/input/<%=i%>"><%=i %></a>
<% } %>
4 然后
@RequestMapping("/input/{p}")
public String list(@PathVariable("p")Integer p,Model model){
//查询数据
Collection<Student> all= studentService.selectAll(p*4-4);
model.addAttribute("emps", all);
return "list";
}
还有mapper
<select id="selectAl" resultType="cn.lm1234.domain.Student">
select * from student limit #{stuno},4;
</select>
5.最后是调用注入 Static 引入Controller功能,ssm模式好像不支持jsp
简单来讲,就是引用各种数据无法办到!
一开始直接上手ssm+前端就很迷,本来基础没打好,现在自己实现了一把感觉有点印象!