dao中
 public  List<EmployeeInfo> queryInfo() throws Exception;
dao的实现中
@Override
 public List<EmployeeInfo> queryInfo() throws Exception {
  return this.getHibernateTemplate().find("from EmployeeInfo ");
 
 }
service中
 public  List<EmployeeInfo> queryInfo() throws Exception;
 
service的实现中(BO)
@Resource private EmployeeDao dao;
@Override
 public List<EmployeeInfo> queryInfo() throws Exception {
  
  return dao.queryInfo();
 }
Action中
public String queryEmpinfo(){
  
  try {
   HttpServletRequest request=ServletActionContext.getRequest();
   List<EmployeeInfo> selectempinfo= empService.queryInfo();
   request.setAttribute("selectempinfo", selectempinfo);
   if(selectempinfo!=null){
    return "index";
   }
  } catch (Exception e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  return "myJsp";
 }
页面1
 <a href="EmployeeAction_queryEmpinfo.action">单击</a><br/>
页面2
<s:iterator value="#request.selectempinfo">
   <tr>
       <td><s:property value="staffCode"/></td>
       <td><s:property value="workDate"/></td>
    <td><s:property value="week"/></td>
    <td><s:property value="workStart"/></td>
    <td><s:property value="workEnd"/></td>
   </tr>
   </s:iterator> 
   </table>ssh 数据库jsp读取数据显示

解决方案 »

  1.   

    <s:iterator value="#request.selectempinfo" id="info">
       <tr>
           <td><s:property value="#info.staffCode"/></td>
           <td><s:property value="#info.workDate"/></td>
           <td><s:property value="#info.week"/></td>
           <td><s:property value="#info.workStart"/></td>
           <td><s:property value="#info.workEnd"/></td>
       </tr>
     </s:iterator> 
      

  2.   


    <s:iterator value="#request.selectempinfo" var="info">
       <tr>
           <td><s:property value="info.staffCode"/></td>
           <td><s:property value="info.workDate"/></td>
        <td><s:property value="info.week"/></td>
        <td><s:property value="info.workStart"/></td>
        <td><s:property value="info.workEnd"/></td>
       </tr>
       </s:iterator>注:info.后面的字段与EmployeeInfo中的相对应
      

  3.   

    你调试的时候  List<EmployeeInfo> selectempinfo= empService.queryInfo();这个里面有值没有