2 Replies - 2046 Views - Last Post: 20 October 2012 - 05:18 PM

#1 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Jsp local storage best practice?

Posted 19 October 2012 - 02:24 PM

We're using jsp files with a tomcat server. We have a number of pages with lists of data, and we need to allow the user to make selections on each page. We need to keep track of all selections made while the user is navigating from page to page.

My first thought is to keep the selection record in an array, and to create the array as a Session variable. However, from what I've been able to read, the Session variable is server-based, and I don't see any option to make it part of local storage as you can in ASP.Net. I'm concerned that this means making a round trip to the server every time the user selects or deselects a check box.

I'm sure that there's a pretty standard way to accomplish what I need, but I'm having trouble finding it. I need to store an array in local RAM; it only needs to be available to the current user session, and it needs to be available at any point in that session. What's the best way to do that in Java?

Is This A Good Question/Topic? 0
  • +

Replies To: Jsp local storage best practice?

#2 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1152
  • View blog
  • Posts: 2,530
  • Joined: 05-May 05

Re: Jsp local storage best practice?

Posted 19 October 2012 - 02:37 PM

I'm pretty sure Java EE 6 doesn't support client-side storage. What about local storage in Javascript? There's the new HTML5 Web Storage technology.

Since you say you're concerned with making round trips every time the user selects a check box, can I assume that navigating from page to page doesn't involve making server requests either?
Was This Post Helpful? 1
  • +
  • -

#3 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Jsp local storage best practice?

Posted 20 October 2012 - 05:18 PM

Thanks for replying blackcompe. Navigation between pages may or may not involve a trip to a server. The user selects a page which has a form for search criteria, then back comes a page with a table having the results of that search. (Each row of the table has a check box that the user can select.) The user can then drill down (no server trip) by selecting links to a new page with related data, or go back to another page with search criteria and search again (server trip). During this process, the user can select row items from the table and then move to new pages and so on. When finished with selections, user will navigate to another page which will have a table populated with all his selections.

We were thinking about having a user hit a button to post changes every time he goes to a new page, but I'd rather avoid that if I can.

Looking at the HTML5 web storage, and it looks like just the thing if we can use Javascript. I heard we can't use jQuery, but I believe we're using Javascript. All I've seen so far is xsl, Vb.Net and Java. I'll bring it up on Monday and see if we can use it. Thanks for the tip, and please feel free to share anything further you might have in mind.

This post has been edited by BobRodes: 20 October 2012 - 05:19 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1