Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Hi I am unable to display data from controller to jsp page in spring, am new to spring, this is my controller

List<DocDto>  list =DocService.getDocs();
            DocDto docList = new DocDto();
            docList.setdocType(doc_type);
            docList.setdocSubType(doc_subtype);
            jobList.setTransactionId(transaction_id);   
            model.addAttribute("docList", docList);

This is my jsp table

 <c:forEach var="o" items="${list}">
 <tr> 
<td>
<c:out value="${o.doc_type}" /></td>
<td><c:out value="${o.doc_subtype}" /></td>
</td>
</tr>

This is not displaying any data in my jsp, just simply blank table it is displaying. Any help would be appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
229 views
Welcome To Ask or Share your Answers For Others

1 Answer

Instead of ${list} use ${docList} in for each loop. If it did not works then follow following steps :

Check you included proper jstl library in jsp

  <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

and using proper jar for jstl library.

Check DocDto for doc_type,doc_subtype variables properly spelled or not.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...