S
sdavids
Hey all, I am wondering if you can remove a session attribute on an
onchange command, this is what I have:
<SELECT name='TestMenu2' onChange='<%session.removeAttribute("test");%>
clearMenu(2);clearMenu(3);this.form.submit();'>
I have 4 menus which are used to run a SQL query, and the test element
is the data in the final drop down box which is selected. Although if
you change the data in any of the previous drop down boxes I want to
remove the session element of the final drop down box since it is no
longer valid. I use the session.getAttribute("test"); in the page
header to display links since it knows that the final element was
selected. But for some reason this isnt working, so I added:
if((request.getParameter("TestMenu4") == null ||
request.getParameter("TestMenu4").equals(""))&&
session.getAttribute("test") != null){
session.removeAttribute("test");
}
to my JSP page which ends up removing the attribute, but doesnt show
the difference in the page header until the page is finally refreshed,
which I dont beleive there is an easy way to do in the if statement. I
tried submitting the form in the if statement after the session
attribute was removed but it lost all of my data from the drop down
box, so I took that out.
Any help would be much appreciated.
onchange command, this is what I have:
<SELECT name='TestMenu2' onChange='<%session.removeAttribute("test");%>
clearMenu(2);clearMenu(3);this.form.submit();'>
I have 4 menus which are used to run a SQL query, and the test element
is the data in the final drop down box which is selected. Although if
you change the data in any of the previous drop down boxes I want to
remove the session element of the final drop down box since it is no
longer valid. I use the session.getAttribute("test"); in the page
header to display links since it knows that the final element was
selected. But for some reason this isnt working, so I added:
if((request.getParameter("TestMenu4") == null ||
request.getParameter("TestMenu4").equals(""))&&
session.getAttribute("test") != null){
session.removeAttribute("test");
}
to my JSP page which ends up removing the attribute, but doesnt show
the difference in the page header until the page is finally refreshed,
which I dont beleive there is an easy way to do in the if statement. I
tried submitting the form in the if statement after the session
attribute was removed but it lost all of my data from the drop down
box, so I took that out.
Any help would be much appreciated.