求大神帮看下action使用List传值,jsp使用<s:iterator>迭代所有结果,但是Jsp页面一片空白
我正在做一个Ssh整合的项目,我想用action使用List传值,jsp使用<s:iterator>迭代所有结果。可是jsp页面一片空白,list的内容console都能正常输出,是不是没有传递到jsp页面呢
SelectAction部分代码:
public List<ReportFormBeans> Reportlist;
public List<ReportFormBeans> list = new ArrayList<ReportFormBeans>();
public List<ReportFormBeans> getReportlist(){
return Reportlist;
}
public void setReportlist(List<ReportFormBeans> Reportlist) {
this.Reportlist = Reportlist;
}
public String toReportGetter()throws Exception
{
try {
int i = 1;
int max = selectService.getReportCount();
while(i <= max){
ReportFormBeans reportFormBean = new ReportFormBeans();
BeanUtils.copyProperties(reportFormBean , selectService.getReport(i));
list.add(reportFormBean);
System.out.println(reportFormBean.getSid());
i++;
}
this.setReportlist(list);
return SUCCESS;
}
select.jsp部分代码:
<s:iterator value="list">
<tr>
<td><s:property value="sid"/></td>
</tr>
</s:iterator>
console口输出:
Hibernate:
select
count(*) as col_0_0_
from
report report0_
Hibernate:
select
report0_.sid as sid1_0_,
report0_.mark as mark1_0_,
report0_.qid as qid1_0_,
report0_.sname as sname1_0_,
report0_.sno as sno1_0_,
report0_.t1 as t6_1_0_,
report0_.t2 as t7_1_0_,
report0_.t3 as t8_1_0_,
report0_.t4 as t9_1_0_,
report0_.t5 as t10_1_0_
from
report report0_
where
report0_.sid=?
1
Hibernate:
select
report0_.sid as sid1_0_,
report0_.mark as mark1_0_,
report0_.qid as qid1_0_,
report0_.sname as sname1_0_,
report0_.sno as sno1_0_,
report0_.t1 as t6_1_0_,
report0_.t2 as t7_1_0_,
report0_.t3 as t8_1_0_,
report0_.t4 as t9_1_0_,
report0_.t5 as t10_1_0_
from
report report0_
where
report0_.sid=?
2
这个以前纯struts2的时候是好用的,现在ssh整合使用就不灵了
------解决方案--------------------JSP一片空白估计不是页面的事,楼主看看控制台报错了嘛,通常一片空白是你跳转有错误,STRUTS配置有问题,你Action最后的SUCCESS配置的页面地址是你的那个页面吗?如果页面有错误应该会报异常,你说的一片空白感觉就是路径没配对
------解决方案-------