reset password
Author Message
harry_520
Posts: 76
Posted 13:48 Feb 18, 2013 |

In my project displaying controller, I defined

List<ProjectsEntry> entries = new ArrayList<ProjectsEntry>(); 

getServletContext().setAttribute("pentries", entries);

and on the jsp page, I used

<c:forEach items="${pentries}" var="entry" varStatus="status">

<td/>${entry.project}</td> 

<td>${entry.postedBy}</td>

etc. to get the entries to display. But after running the program and entering all the information, the project displaying page was still empty, nothing was added. Did I do anything wrong? In my project entry class, I defined variables project, postedBy, etc.

Last edited by harry_520 at 13:49 Feb 18, 2013.
jlima3
Posts: 3
Posted 14:58 Feb 18, 2013 |

Well, looks like you are making a new List, thus, there is nothing to show.

How about having a method that retrieves a project based on something unique (like an id,) and using that to get the entry you want based on parameters you pass via a link (linktopage&parameter=uniqueid)?

 

harry_520
Posts: 76
Posted 15:26 Feb 18, 2013 |

JLIMA, thanks for your suggestion. I'm gonna try it.

Last edited by harry_520 at 15:28 Feb 18, 2013.
shussain
Posts: 21
Posted 12:12 Feb 19, 2013 |

well if i am not wrong you r trying to retrieve list from servletcontext and display in project list page. in such case u have to first get Attributes from servlet context and den store in the new list like how you did in first line. Then store it in application scope (request.setAttribute("pentries", entries). Nothing needs to be done in jsp page.