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 8801649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:53:19+00:00 2026-06-14T00:53:19+00:00

I’m developing a single page jQuery & Backbone.js web app. The backend is a

  • 0

I’m developing a single page jQuery & Backbone.js web app. The backend is a JBoss 6 application server.

Until now we had the following structure:

  • There is only one servlet (front controller). Every request from the JavaScript client goes through here.
  • In the servlet – at the first request of a certain JS client – I make a look p to a stateful session bean. For the next requests of this client, I store the result of the look up in an HTTP session container. So every JS client has exactly one stateful session bean. This connection is kept by a session cookie.

Now I have an additional requirement:

When the user has two browser tabs (in one browser), they should have two isolated instances of the web app in every browser tab. Because of that I have a problem with session cookies because this session cookie is for all browser tabs.

I have to change the structure so that:

  • The servlet has to generate a new session ID for the first request of a certain JS client. This session ID is communicated to the client.
  • With every POST to the backend the JS client has to send this session ID.

My question is:

Until now I saved the result of the look up in an HTTP Session object and I hadn’t to think about generating a session ID. But now I have to store this somewhere else, where?

Has anybody experience with this kind of setting and can help me?

Update:
Thank you BalusC for this very interesting approach.
When I understood you well, this means:

All individual JS clients of the tabs of one browser share one HTTP session object. And in this HTTP session object, every tab has its own entry point. That sounds really good. So I still can use the whole HTTP session infrastructure and don’t have to reinvent the wheel.

  • 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-14T00:53:20+00:00Added an answer on June 14, 2026 at 12:53 am

    Autogenerate an unique value on the initial GET request which you store and pass around on every subsequent postback as a hidden input value. Use this unique value as identifier of the session attribute representing the view-scoped data.

    During the 1st request on a brand new session, do:

    Map<String, ViewData> viewScope = new HashMap<String, ViewData>();
    session.setAttribute("viewScope", viewScope);
    

    (the ViewData represents the view-specific data you’d like to track across postbacks on the same view)

    During every GET request, do:

    String viewDataId = UUID.randomUUID().toString();
    viewScope.put(viewDataId, new ViewData());
    request.setAttribute("viewDataId", viewDataId);
    

    During generating the HTML, do:

    <input type="hidden" name="viewDataId" value="${viewDataId}" />
    

    During every POST request, do:

    ViewData viewData = viewScope.get(request.getParameter("viewDataId"));
    // Get/set view-specific data in there.
    

    Make sure that jQuery also passes this hidden input around (which shouldn’t be a big problem if you already properly use $(form).serialize() or e.g. AjaxForm plugin to ajaxify the forms).

    If you’re familiar with Java EE’s MVC framework JSF, then it may be useful to know that its @ViewScoped annotation works roughly the same as described above. See also a.o. How to choose the right bean scope?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.