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

  • SEARCH
  • Home
  • 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 6858125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:07:06+00:00 2026-05-27T02:07:06+00:00

I would like to ask a theoritical question about how some web sites work.

  • 0

I would like to ask a theoritical question about how some web sites work. As an example.Let’s say that I’m in the A market on line store. I placed a case of wine in the shopping trolley, The page appeared with this URL:

www.A.co.uk/webstore/basket.asp?calledby=normal&ProductCode=6379044

I continued shopping and then placed a different wine in the trolley and again the page appeared with this URL

www.A.co.uk/webstore/basket.asp?calledby=normal&ProductCode=6323456

I then Clicked the Back Button on the browser three times and the trolley page appeared again. This time contained ONLY the first item and NOT the second.

In another website I showed the following:

I selected a case of wine. As a result the form containing the wine was posted to this ASP page basket.asp?Item=3605681, where Item is the ID of the particular case of wine. However the page appeared in the browser had a different URL:

www.B.com/extra/basket.aspx?acstore=10&ba=0

I then added another case of different wine to basket. The address that appeared was exactly same as previous one.

When I clicked the Back Button The Shopping basket always showed that I have two items in the basket. How do you think that these Online stores have programmed the site so that shopping basket always shows its current state even if the user presses the Back Button several times? Also, what’s the difference of these two situations?

  • 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-05-27T02:07:07+00:00Added an answer on May 27, 2026 at 2:07 am

    The basket is likely stored in the session. More than often the session is in turn backed by cookies. In JSP/Servlet it’s the JSESSIONID cookie. To test it yourself, locate the cookie in browser’s cookie store and delete it. You’ll see that a page refresh will result in an empty basket. For more detailed background information, please read How do servlets work? Instantiation, sessions, shared variables and multithreading.

    In JSP/Servlet terms, the basket could be retrieved/precreated as follows:

    Basket basket = (Basket) session.getAttribute("basket");
    
    if (basket == null) {
        basket = new Basket();
        session.setAttribute("basket", basket);
    }
    
    // ...
    

    This lives then as long as the user is interacting with the same webpage within the same session. Any products could be added to the basket as follows:

    String productCode = request.getParameter("productCode");
    Product product = someProductService.find(productCode);
    
    if (product != null) {
        basket.addProduct(product);
    }
    
    // ...
    

    In JSP you could then display it as follows:

    <table>
      <c:forEach items="${basket.products}" var="product">
         <tr>
            <td>${product.code}</td>
            <td>${product.description}</td>
            <td>${product.quantity}</td>
            <td>${product.price}</td>
         </tr>
      </c:forEach>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to ask a theoritical question. Assuming that an application is using
I would like to ask you a question about implementing mutual authentication with Kerberos,
I would like to ask a theoretical question. If I have, for example, the
I would like to ask a question. Now i'm training about iPhone Programming. I'm
What I would like ask is best illustrated by an example, so bear with
I would like to ask for some simple examples showing the uses of <div>
I would like to ask how licensing works on multiple instances? Suppose that I
i would like to ask, if there is some framework in Java which can
Would like to ask about how do I write a preg_replace in PHP to
I would like to ask something about query using mysql I have this table

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.