I am using Apache Tiles 2 in my Spring 3 MVC application,the layout is : a menu on the left and body on the right.
layout.jsp
<table>
<tr>
<td height="250"><tiles:insertAttribute name="menu" /></td>
<td width="350"><tiles:insertAttribute name="body" /></td>
</tr>
</table>
menu.jsp
<div><ul>
<li><a href="account.html">account</a></li>
<li><a href="history.html">history</a></li></ul></div>
body of history.jsp
<c:forEach var="history" items="${histories}"><p><c:out value="${history}"></c:out></p></c:forEach>
I also have a controller for history
@Controller
public class HistoryController {
@RequestMapping("/history")
public ModelAndView showHistory() {
ArrayList <String> histories = read from DB.
return new ModelAndView("history","histories",histories);
}
}
So, everytime when I click the history link at the menu, the showHistory() is called.
But there is a more complicate case. The history DB has hundreds entries, so we decide to display the first 10 only when history.jsp displays first time, then add a "show more histories" button to the history.jsp to display the next 10 by we adding another controller.
The problem is, when a user does the following:
- clicks history link, it shows 0-9 histories,
- clicks "show more histories" to display 10 to 19,
- clicks account link to go back to the account page,
- clicks history link again, instead of the history.jsp display 10 to 19, it displays 0-9.
How can I make the history.jsp to display the last visited histories instead of display from the beginning.
I am very new to Spring, all suggestions are welcome. Thanks.