2008-11-20 7 views
1

Ceci est mon recours collectifaction et Jsp pour obtenir le iterator et l'afficher

public Iterator<CgConsultant> getSearchresult() { 

     List<CgConsultant> list =userSearch.getConsultantMatches(searchstring); 
     System.out.println("The size of the resutl list:"+list.size()); 
     Iterator<CgConsultant> iterator = list.iterator(); 
     CgConsultant obj; 
     while(iterator.hasNext()){ 
      obj = (CgConsultant)iterator.next(); 
      System.out.println(obj.getUsername()); 
      System.out.println(obj.getFirstName()); 
      System.out.println(obj.getLastName()); 
     } 
     return iterator; 
    } 

Et je dois remplir les données jsp et l'afficher dans la jsp

Je suis gettin le statut de retour mais comment remplir les données d'affichage n .. il

ceci est mon jsp

<head> 
    <title><fmt:message key="signup.title"/></title> 
    <meta name="heading" content="<fmt:message key='signup.heading'/>"/> 
</head> 

<body> 

     <h1> Search Complete</h1> 
     <h2> Details are..</h2><br> 

     <s:property value="Searchresult"/> 

</body> 
</html> 

S'il vous plaît indiquer tout suggestion ..

Répondre

0

Taglib c est http://java.sun.com/jsp/jstl/core

  <c:forEach items="${Searchresult}" var="cgConsultant"> 
        <c:out value="${cgConsultant.username}"/> 
        <c:out value="${cgConsultant.firstName}"/> 
        <c:out value="${cgConsultant.lastNameName}"/> 
      </c:forEach> 

Ajouter une belle html

+0

oui .. M obtenir la valeur d'index du tableau comme la sortie .. java.util.AbstractList $ Itr @ 1ddff76 –

Questions connexes