件商品接收不到action的数据
//NewsAction.java
public String showNews() throws Exception {
String string = "";
try {
if(num == null) {
num = "1";
}
rowCount = newsService.countNews("select count(n) from com.sinosoft.canshishi.pojo.News n", null);
news = newsService.queryNews("from com.sinosoft.canshishi.pojo.News", null, Integer.parseInt(num), pageSize);
System.out.println("news-->" + news.size());
page = new PaginationUtil(pageSize, num, rowCount);
System.out.println("pageSize-->" + pageSize);
System.out.println("num-->" + num);
System.out.println("rowCount-->" + rowCount);
string = "showNews";
} catch(Exception e) {
e.printStackTrace();
string = "error";
}
return string;
}
//_showNews.jsp
<body>
<%
String path = request.getContextPath();
request.setAttribute("path", path);
%>
<c:forEach items="${news}" var="news">
${news.maintitle } <br/>
</c:forEach>
<jsp:include page="/common/_pagination.jsp">
<jsp:param name="url4page" value="${path}/test/newsAction!showNews.action"/>
</jsp:include>
</body>
//显示
首页 前一页 [0] 末页 后一页 共页