views:

141

answers:

1

I have an options menu, over a jsp page, on which users explore items, that have sub-items, that have sub-sub-items and so on. Items are collapsable, so the user can see the hierarchy of the items he want.

The menu is expanded manipulating the css using javascript and jquery.

This menu is shown on all the pages of the application, and, every time the users goes to a new page, the menu, must be shown as the user left it on the previous page (all the menu items that the user expandend must be remembered).

He can change page by submiting a form, following a link, or going back on the browser.

How can this be donde? Is uploading the HTML portion of the menu to the session a viable solution? Cookies perhaps? Or there is a better way ?

PS: also struts2 is used on the application.

+1  A: 

Make a few java classes that represents (Menu, MenuItem) and store them in the session on the server. Assign each menu-item a unique integer id, and submit this id to the server when the user clicks on it. You can use jsp to render the menu in its current state based on the java classes.

krosenvold
How do I submit the data? Thanks.
Mg
I would use AJAX to submit the state of the menu and have a controller on the server side handle the submission and update into the Session.
Michael Glenn
And how can I get the session id of the user with javascript in order to send it on the submission, so the controler can identify which menu I am modifing?
Mg
place it in a javascript variable within the page when you generate it the first time.
tucuxi