Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7892069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:46:37+00:00 2026-06-03T06:46:37+00:00

I am using Apache Tiles 2 in my Spring 3 MVC application,the layout is

  • 0

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:

  1. clicks history link, it shows 0-9 histories,
  2. clicks “show more histories” to display 10 to 19,
  3. clicks account link to go back to the account page,
  4. 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:46:38+00:00Added an answer on June 3, 2026 at 6:46 am

    What you would do is store in the session the last requested range. If the user does not specify a range (in the request) you use the session stored on.

    Something like this

    @RequestMapping("/history")
    public ModelAndView showHistory(@RequestParam(value="startIndex", defaultValue="-1") Integer startIndex, HttpSession session) {
        Integer start = Integer.valueOf(0);
        if (startIndex == null || startIndex.intValue() < 0) {
            // get from session
            Integer sessionStartIndex = (Integer) session.getAttribute("startIndex");
            if (sessionStartIndex != null) {
                start = sessionStartIndex;
            }
        } else {
            start = startIndex;
        }
        session.setAttribute("startIndex", start);
        ArrayList <String> histories = read from DB, starting with start.
        return new ModelAndView("history","histories",histories);
    
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my application using Spring MVC + Apache 2 tiles + Spring security,
I am using java, spring mvc and apache tiles in my web application. I
I am using Apache Tiles 2.1.4 with Spring MVC 3. I have managed to
I am using intellij, spring mvc and tiles. At least I am trying :)
while using tiles along with spring i m getting following error: java.net.UnknownHostException: tiles.apache.org program
I have been trying to integrate Spring (3.0.4 and 3.0.5) MVC with Apache Tiles
I have a project setup using Spring 3, Apache Tiles 2 and Maven. Before
I have problem with displaying error message in spring Application.i am using Spring MVC
I am using Spring MVC 3.1.x with Tiles 2.2.2 (bootstrapped project with Roo) and
We have a Spring application that uses Apache DBCP for connection pooling. Our app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.