I have created a list in Servlet(List of entities). I am trying to iterate through the list and fetch the properties in JSP
I am able to iterate through the list in JSP, but not sure how to retrieve the Properties of the Entity. What am I missing here?
Servlet that inserts data into Datastore,
DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
Entity adminUser = new Entity("AdminUser");
adminUser.setProperty("mail_id", "mymailid@gmail.com");
ds.put(adminUser);
Servlet that creates the List,
public void doGet(..) {
...
PreparedQuery pq = ds.prepare(q);
List<Entity> adminList = pq.asList(FetchOptions.Builder.withLimit(10));
req.setAttribute("adminList", adminList);
resp.setContentType("text/html");
RequestDispatcher jsp = req.getRequestDispatcher("/WEB-INF/DisplayAdminPage.jsp");
jsp.forward(req, resp);
...
}
JSP that iterates through the list
<c:forEach items="${adminList}" var="adminEntity">
<tr>
//This displays the entire entity, but not sure how to fetch
//the individual property??
<td>${fn:escapeXml(adminEntity)}</td>
</tr>
</c:forEach>
I also tried something like this to fetch the property ; ${fn:escapeXml(adminEntity.mail_id)}, but is not working
PS : I have followed the suggestion given in this post