If you want to use javascript, there are 3 workarounds for this:
1. cookies
2. one page in a frame of height=0 and width=0. In this page, all you have are hidden input elements which you fill with values and then retreive the values
3. with hidden form fields in the current page, then, submit the page and the variables will be part of the request.
There is always JSP and the session variable which is far more powerful in terms of the things you can pass from one page to the other.
Yo choose.