大家好,我用SSH开发WEB程序。框架包括Action + Service + Service Impl + DAO + DAO Impl + Generic (泛型)
我现在想要达到的功能是在首页上显示会议信息和会议文档信息。这个两类信息分别在不同的表里。我的想法是在一个Action方法里获得两个availableItem,然后返回到一个web页面上。但是第一个Item可以显示,第二个不显示,我把代码贴出来<!-- 首页信息列表 -->
  <action name="ConfListHome" class="tconferenceAction" method="listmeetinghome">
<result>/index1.jsp</result>
  </action>
从表里取前5条会议以及文献信息// 首页信息列表
 public String listmeetinghome() throws Exception {
   queryName ="";
   queryValue ="";
   availableItems1 = tpageService.queryItems(TPage.class, "docutitle");
   availableItems = tconferenceService.queryItems(TConference.class, "id", queryName, queryValue, 4, 1);
   return SUCCESS;
}
HTML代码中间有些省略<s:iterator value="availableItems" status="tConference">  
  <tr>
    <!--显示会议名称 -->
      <td><s:property value="conferencename" /></td>
   <!--显示会议举办地 -->
      <td align="center"><s:property value="conferencelocation" /></td>    
  </tr>
</s:iterator> 

<s:iterator value="availableItems1" status="tPage">  
  <tr>
    <!--显示文献名称 -->
      <td><s:property value="docutitle" /></td>
    <!--显示文献作者 -->
      <td align="center"><s:property value="docuauthors" /></td>    
    </tr>
</s:iterator> 
运行结果就是第一部分的会议信息显示出来的,而第二部分的文献信息只显示了5个空行

解决方案 »

  1.   

    Action层的代码贴错了
    public String listmeetinghome() throws Exception {
      queryName ="";
      queryValue ="";
      availableItems = tconferenceService.queryItems(TConference.class, "id", queryName, queryValue, 4, 1);
      availableItems1 = tpageService.queryItems(TPage.class, "id", queryName, queryValue,4,1);
    return SUCCESS;
    }
      

  2.   

    有一种查错方式叫做Debug....
    strut2里貌似也有<s:debug>这个标签,我怀疑是业务层有问题,自己查下吧