Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: jsp and javascript - REPOST


Message #1 by John Owen <JOWEN@f...> on Tue, 10 Jul 2001 08:08:30 -0500
Greetings all,

Currently, I am using javascript to catch all user actions that cause
onUnload() to be triggered in a jsp page. I'm doing this in order to know
when the user has closed the browser via the x button (by eliminating all
other possibilities). It works fine for all links and included jsp pages,
except that each page includes another jsp page that includes a submit form.
This page doesn't seem to recognize the parameter I'm using to tell each
link/action how to behave. All pages are contained within a window created
with javascript. I'll include some code and explanation below. I hope
someone can help me past this final hurdle. :)

Each page has the following <body> tag :

<body onLoad="closing=true" onUnload="if(closing)
window.location='http:/servlet/net.ftt.foundation.ControllerServlet?Task=net
.ftt.soc.LogOut';location.reload();">

This allows me to set closing to false on all other links/actions if I don't
want the LogOut task to trigger. An example of this is :

<td><img src="../webapp_images/accountsTabs.gif" width="154" height="20"
usemap="#AccountsTabs" border="0" onClick="closing=false"></td>

I can even use the closing variable in jsp-included pages as shown above.
However, it seems that if the jsp-included page has a submit form, the
closing variable and its value are out of scope (or just ignored).

Example :

<jsp:include page="/UB/CustMgtSidebar.jsp" flush="true"/> <-- This page has
links to other functions, but no form

<jsp:include page="/UB/CAMAddComment.jsp" flush="true"/> <-- This page has
the submit form

Any insight into how to work around or resolve this is greatly appreciated.

Thanks in advance,

John Owen
Federal TransTel
Senior Developer


  Return to Index