I have a JSP with a Javascript tree control and I want the user to be able to hide or show this tree at the touch of a button and for this change of state to be carried through to other pages visited, i.e. if on page A, the user hides the tree, then on page B, the tree should remain hidden and so on until the user decides to show the tree.
To do this, I'm using AJAX to set a session variable on the server which is checked when a page is loaded. Now this works fine when the page in question has no query string in its URL.
But with a page with a URL like:
If I invoke the show/hide button, I get a Java NumberFormatException error because the query string is lost. But manually reloading the page after this shows the page with the tree updated.
The tree's HTML is built on the server and displayed in an HTML div on each page.
My understanding is that AJAX is meant to update only a part of the page and the page is written in this manner to only allow the contents of a div to be updated. But I can not work out why the query string is being lost.
I wonder if the AJAX is trying to force a full page reload?
I do know that the AJAX call is reaching the servlet correctly. But the servlet is not set to call another page.
Has anyone seen this before and do you know a workaround?