File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes updating session variable on onChange event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "updating session variable on onChange event" Watch "updating session variable on onChange event" New topic
Author

updating session variable on onChange event

Priya Lavti
Ranch Hand

Joined: Oct 11, 2004
Posts: 41
Hi all,

I want to update JSP session variable on onchange event of a dropdown. Please note that I am not submitting the form with this event, so I can not use hidden form Inputs. Looking forward for other solutions.

~Pinks


-Priya
SCJP 5.0
Scheepers de Bruin
Ranch Hand

Joined: Jul 19, 2005
Posts: 99
How about:

onchange="window.open('http://urlThatNotifiesServerToUpdateSession?newValue=nv');"

Upon receiving the request, update the variable and send the client a page that'll close it:
<body on_load='window.close();'>
(without the underscore)


We're doomed!!<br />Yay!!!<br />No that's bad Girr!!<br />Yay!!!
Priya Lavti
Ranch Hand

Joined: Oct 11, 2004
Posts: 41
Thanks for the quick reply Bruin
but it will open a new window, that I can't do in my project.
Is there any other solutions...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

You must submit a request back to the server in order to update the server-side session. You could do this without opening a new window or refreshing the current page by either submitting a request to a hidden iframe or by using the XMLHttpRequest javascript object (doing so has come to be termed 'Ajax' technology).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: updating session variable on onChange event
 
Similar Threads
Help
Javascript submit problem
AJAX refresh problem in IE .
Passing values to form bean string array
<h:selectOneListbox with dynamic values submit error