I have this problem.
Is there any problem on directly accessing POJO class or an entity class in JSP, what is the best practice for that ?
I have this problem.
Is there any problem on directly accessing POJO class or an entity class in JSP, what is the best practice for that ?
Please see @BalusC's excellent answer on the subject:
https://stackoverflow.com/a/3180202/2112089
Basically, accessing POJOs is discouraged because it leads to unmaintainable code. It is much better to use JSTL and Expression Language (EL).
To do that, here's his example:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
...
<table>
<c:forEach items="${products}" var="product">
<tr>
<td>${product.name}</td>
<td>${product.description}</td>
<td>${product.price}</td>
</tr>
</c:forEach>
</table>
The rest of @BalusC's series on JSP:
https://stackoverflow.com/a/2097732/2112089
https://stackoverflow.com/a/3106909/2112089