我正在使用spring,hibernate进行MVC项目,当我在displat:table中的页面之间导航时遇到问题,它只显示列表的前10项(pagesize = 10)。当我导航到其他页面时,它会显示一个网址:http://localhost:8080/pinky_spring/clothes.jsp?d-1339940-p=7和404错误。这是我对display的定义:table
<display:table id="table_clothes" name="clothes" pagesize="10"
requestURI = "/clothes.jsp"
keepStatus = "true"
uid = "myTable"
decorator="table_decorate.ClothesDecorate" >
<display:column property="id" title=""/>
<display:column title="no">
<c:out value="${table_clothes_rowNum}"/>
</display:column>
<display:column property="name" />
<display:column property="price" />
<display:column property="dayUpdate" title="Update" sortable="true"/>
<display:column property="pictures" title="Img"/>
<display:column property="quantities" title="Qty"/>
</display:table>
这是我的控制器
@Override
public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
ModelAndView mv = new ModelAndView("clothes");
List<Clothes> clothes = new ArrayList<>();
try {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
clothes = session.createQuery("from Clothes").list();
session.getTransaction();
session.close();
} catch (Exception e) {
} finally {
mv.addObject("clothes", clothes);
}
return mv;
}
请帮帮我,我是java网站的新手!
答案 0 :(得分:0)
display:table标签的requestURI
应指向控制器的网址。
答案 1 :(得分:0)
解决方案非常简单,我设置了requestURI =&#34;&#34;问题解决了!