Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Keeping user preferences for that page after periodic page refresh for multiple browsers / PC

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like to keep the user preferences for that JSP web page (e.g. the number of rows per table) after periodic page refresh.
The solution need to work for multiple browsers on the same or different PCs.
Please note that the user preferences (e.g. the number of rows per table) for different tabs (pages) on the same browser may be different.
URL Parameter Passing is the only approach I can think of.
e.g. http://127.0.0.1:8080/datadisplay?page=1&rowsperpage=20
Are there other approaches?
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't that what databases are for?
 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Isn't that what databases are for?



If database is used, then each browser tab (JSP page) within the same browser will be assigned an unique page id. The user preferences for that page will store in the database with the page id as key.
How to differentiate each browser tab (JSP page) from other tabs within the same browser so as to assign an unique page id for each browser tab?
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a data modeling issue that you'd need to solve.You could associated each distinct area that needs prefs by some unique name.
 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:That's a data modeling issue that you'd need to solve.You could associated each distinct area that needs prefs by some unique name.



How about this?
Every new JSP page is created with a hidden element which has an unique name (id). When this page is refreshed periodically by javascript, the hidden element will be submitted with this unique name.
The "database" can be implemented as JSP session at the server or as cookie at the client.
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Why would it need to be periodically updated?
 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

Why would it need to be periodically updated?



Polling a server database (which is updated by another process) to retrieve the latest data.
 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand the pros and cons of using JSP session or cookie.
How is the URL Parameter Passing approach compare with either JSP session or cookie approach?
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How would that satisfy this requirement:

The solution need to work for multiple browsers on the same or different PCs.

?
 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:How would that satisfy this requirement:

The solution need to work for multiple browsers on the same or different PCs.

?




I don't know what is the problem - I think URL Parameter Passing can satisfy the requirement.
The same or different URL parameters can be passed to different tab or browser.
e.g.
IE tab 1: http://127.0.0.1:8080/datadisplay?page=1&rowsperpage=20
IE tab 2: http://127.0.0.1:8080/datadisplay?page=1&rowsperpage=10
Chrome tab 1: http://127.0.0.1:8080/datadisplay?page=2&rowsperpage=20
Chrome tab 2: http://127.0.0.1:8080/datadisplay?page=2&rowsperpage=15
 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following is my attempt to "Keeping user preferences for that page after periodic page refresh for multiple browsers / PC".
It is still work in progress and contains bugs.
I like to pass user input between two Controllers and display user input after submit.
The displayHw.jsp and displayHwController handles the user input.
It reads from the database and display the data.
It posts the write input to displayHwMgrController.
The displayHwMgrController writes to the database and redirects back to the displayHwController.
How to pass user input between two Controllers?
The user input disappear from the jsp page after the Apply button is clicked to submit the user input.
How to display the recently user input on the jsp page?
I am new to Spring 2.5.x and Prototype javascript library.
Please help.
Thanks.

displayHw.jsp


displayHwMgrController.java

displayHwController.java


reply
    Bookmark Topic Watch Topic
  • New Topic