You're not getting anything because you're not iterating your list of books. Also, you're only printing lots of <input type="text" />
on each iteration. Your code should look like this (assuming that your list of books is lstBooks
and it's already initialized):
<table>
<!-- here should go some titles... -->
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Authors</th>
<th>Version</th>
</tr>
<c:forEach begin="1" end= "${ no }" step="1" varStatus="loopCounter"
value="${lstBooks}" var="book">
<tr>
<td>
<c:out value="${book.isbn}" />
</td>
<td>
<c:out value="${book.title}" />
</td>
<td>
<c:out value="${book.authors}" />
</td>
<td>
<c:out value="${book.version}" />
</td>
</tr>
</c:forEach>
</table>
After understanding your problem based on comments, make sure the ${no}
variable is available at request.getAttribute("no")
. You can test this using a scriptlet (but this is a bad idea) or just using <c:out value="${no}" />
.
Note that as I've said, the variable should be accesible through request.getAttribute
, do not confuse it with request.getParameter
.
By the way, you can set a variable if you know which could be it's value like this:
<c:set var="no" value="10" />
And then you can access to it using ${no}
.
More info: JSTL Core Tag
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…