Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
238 views
in Technique[技术] by (71.8m points)

hibernate - how to display data from controller to jsp using spring mvc?

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...