Struts的页面跳转
在JSP中加入struts标签<html:link></html:link>,让他跳转到下一页,在link中有参数,是让Action进行判断然后执行跳转到新的页,相关代码如下,请高手看看那里错了:
JSP
<html:link page="/legalaid/legalAidSeAction.do?action=select6">网站首页测试
</html:link>
action
if (action.equalsIgnoreCase("select6")) {
allList = bean.select_6();
rowSetPage = new RowSetPage(allList, 6);
pageList = rowSetPage.getPageList();
if (pageList != null) {
session.setAttribute("pageList", pageList);
session.setAttribute("page", rowSetPage);
return mapping.findForward("legalAid.select_6.success");
} else {
return mapping.findForward("legalAid.select_6.fail");
}
}
bean:
public ArrayList select_6() {
this.sqlStr = Constants.TABLE19_SELECT_6;
if (prepareStatement(sqlStr)) {
if (executeQuery()) {
try {
while (rs.next()) {
LegalAidForm fform = new LegalAidForm();
//String str = rs.getString("t19_c02");
//fform.setID(rs.getInt("ID"));
fform.setT19_c02(rs.getString("t19_c02"));
arrayList.add(fform);
}
} catch (SQLException ex) {
System.out.println("读取数据库错误");
System.out.println(nuy.comm.Common.formatDate(new
java.
util.
Date()));
}
}
}
return arrayList;
}
STRUTS-config.xml
<action name="legalAidForm" path="/legalaid/legalAidSeAction" scope="request" type="sms.legalaid.LegalAidSeAction" validate="false">
<forward name="legalAid.select_6.success" path="/legalaid/legalAidindex.jsp"/>
<forward name="legalAid.select_6.fail" path="/legalaid/fail.jsp"/>
</action>
点击连接之后,页面到/legalaid/legalAidSeAction.do?action=select5 就显示完成了,空空的什么内容也没有
单独打上/legalaid/legalAidindex.jsp,之后有内容,为什么呢?