0

being new to Java I often run into problems. This time I need help with servlets.

My project has a servlet, that reads data from database (multiple records returned). This data has to be sent to multiple jsp pages.

Ex - servlet returns

Book | chris | 200 Pencil | roger | 5 Pen | Lars | 8

I am current displaying this result on first.jsp with jstl:

<c:forEach items="${results}" var="pr">
<li class="ui-widget-content"> 
<span style="font-size: 15pt;"> <c:out value="${pr.item}"/></span> 
<span style="font-size: 13pt;"> - <B> <c:out value="${pr.name}"/> </B></span>
<span style="font-size: 12pt;"> <c:out value="${pr.price}"/> </span>
</li>

</c:forEach>

I want to run servlet only once to reduce database calls as same data has to be used on all jsp pages namely first.jsp, second.jsp, third.jso and forth.jsp

How could I achieve this?

Thanks in advance.

NewDev
  • 7
  • 1
  • 2

0 Answers0