<jsp:useBean id="request_b_list" class="java.util.ArrayList" scope="request" />
<logic:iterate id="bList" name="request_b_list">
  <tr>
    <td><%=((BrEx)bList).getCreateUser()%></td>
    <td><%=((BrEx)bList).getCreateDate()%></td>
  </tr>
</logic:iterate>

解决方案 »

  1.   

    不知道你具体的情况,我猜测cartMap是你在action中使用request.setAttribute设的,是HashMap类型。
    如果出现你所说的情况,那么你的hashmap可能是这样舍得hashmap.put("xxx",cartbean);
    要得到cartbean下的值可以使用<bean:define>
    <bean:define id="cartbean" name=cartid property=value>
       <bean:write name="cartbean " property="property"/>//property是指你在cartbean中的属性
      

  2.   

    你的Hash中的属性值是String么,也许就是一个Object,所以会这样。你在看看赋值时的代码?
      

  3.   

    从HashMap中根据键取
     我们是放在Vector中,(cartMap为Vector的键)
    <logic:iterate id="cartid" name="cartMap">
       <bean:write name="cartid" property="membername"/> 
    </logic:iterate>
    HashMap试一下,从HashMap中根据键取应该可以吧
      

  4.   

    多谢几位,那怎样从HashMap中分别把value和key取出来?不是一起取
      

  5.   

    你就直接取就行了。
    <logic:iterate id="cartid" name="cartHashMap">
        <bean:write name="cartid" property="key"/>
        <bean:write name="cartid" property="value"/>
    </logic:iterate>
      

  6.   

    <logic:iterate 中加入:type="java.lang.String"
      

  7.   

    hashMap里面存放的确是这样子“lyo.hotmail.shopping.Cartbean@cfa965”
    你把它们一个一个的放到一个ArrayList对象里面,<logic>这个ArrayList对象看一下。
      

  8.   

    那个问题解决了,lj0425的方法可以,其他没试过,不过又遇到新的问题,就是如何用logic:present 的name属性得到 某个错误域的error? 比如我想判断username.required这个具体域有没有错误,有办法吗?
      

  9.   

    楼主看我写的
    <logic:iterate id="findalltrainhead" property="findalltrainheadresult" >      <tr>
            <td nowrap bgcolor="#CCCCCC"><input type="checkbox" name="checkbox22" value="checkbox"></td>
            <td height="31" nowrap bgcolor="#CCCCCC">
    <bean:write name="findalltrainhead" property="trainHeaderCode"/>
    &nbsp;</td>
            <td bgcolor="#CCCCCC">
    <bean:write name="findalltrainhead" property="deptName"/>
    &nbsp;</td>
            <td bgcolor="#CCCCCC">
    <bean:write name="findalltrainhead" property="headerTypeName"/>
    &nbsp;</td>
            <td height="31" bgcolor="#CCCCCC">
    <bean:write name="findalltrainhead" property="telNum"/>
    &nbsp;</td>
          </tr>
          </logic:iterate>我的函数是这样写的
     public ArrayList finAllTrainHead()
                 throws Exception{
          getConnection();  //连接数据库
          PreparedStatement ps = null;
          ResultSet rs = null;
          String sql= null;
          ArrayList arrayList = new ArrayList();//返回结果
          try{
            sql= " select  distinct(Btbl_TrainHeaderInfo.TrainHeaderID),Btbl_TrainHeaderInfo.*, "
                +" Btbl_TrainHeaderType.HeaderTypeName,Btbl_OrganizationInfo.DeptName "
                +"  from  Btbl_TrainHeaderInfo,Btbl_TrainHeaderType,Btbl_OrganizationInfo "
                +"  where Btbl_TrainHeaderInfo.DepartmentCode = Btbl_OrganizationInfo.DepartmentCode "
                +"  and Btbl_TrainHeaderInfo.TrainHeaderTypeId = Btbl_TrainHeaderType .HeaderTypeID  ";
            ps = conn.prepareStatement(sql);
            rs = ps.executeQuery();        while(rs.next()){
             TrainHeadForm trainHeadForm = new TrainHeadForm();
             trainHeadForm.setTrainHeaderCode(rs.getString("TrainHeaderCode"));
             trainHeadForm.setDeptName(rs.getString("DeptName"));
             trainHeadForm.setHeaderTypeName(rs.getString("HeaderTypeName"));
             trainHeadForm.setTelNum(rs.getString("TelNum"));
             arrayList.add(trainHeadForm);
            }
          }catch(Exception ex){
             System.out.println("error call finAllTrainHead():" + ex.getMessage());
          }finally{
             if(conn != null){
               conn.close();
             }
             if(ps != null){
               ps.close();
             }
             if(rs != null){
               rs.close();
             }
          }
          //返回结果
          return arrayList;
      }
    我的execute方法中是这样写的
    if(trainHeadForm.getOperate().equals("findAllTrainHead"))
       {
            ArrayList arrayList = new ArrayList() ;
            try{
                arrayList = finAllTrainHead();
                if(arrayList ==null)
                {
                  ActionErrors errors = new ActionErrors();
                  ActionError error =  new ActionError("trainhead.findalltrainhead.noresult");
                  errors.add(ActionErrors.GLOBAL_ERROR,error);
                  saveErrors(httpServletRequest,errors);
                  //如果车头行增加失败,转向trainHeadAdd.jsp页面
                  return (actionMapping.findForward("findall_trainhead_noresult"));            }
                  HttpSession session = httpServletRequest.getSession();
                  session.setAttribute("findalltrainheadresult", arrayList);
                  return (actionMapping.findForward("findall_trainhead_result"));          }catch(Exception ex)
            {
               throw ex;
            }
       }
        return (actionMapping.findForward("addTrainHead"));
       }
     }注意:
    <logic:iterate id="findalltrainhead" property="findalltrainheadresult" >
    这个id是自己随便定义的便于显示列表中的每行值,property是Action中ArrayList的返回值,另外在actionForm中要写明get set 方法呵呵楼主试验一下可以的