Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to track system generated dialog box/window?

Reply
Thread Tools

How to track system generated dialog box/window?

 
 
Vasu
Guest
Posts: n/a
 
      12-14-2006
Hi

i have a web application that is developed suign struts. When the user
clicks the 'X' button in the window, i want to move to an action class
that performs a database update and then has to close the window.

Kindly help.

Let me know if theres any issue with teh code below:


JSP
-------


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>
<script>
function doUnload(){
if (window.event.clientX < 0 && window.event.clientY < 0) {
alert("Window is closing...");
document.form.action="logout.do";
}
}
</script>
</head>
<body onunload="doUnload()">
<a href="http://www.yahoo.com">Yahoo</a>
</body>
</html>

Struts-config.xml
-----------------------------

<action path="/logout"
type="com.bt.osat.actions.ActionProductStatus"
scope="session"
>

<forward name="success" path="/jsp/logout.jsp"/>
<forward name="failure" path="/jsp/failure.jsp"/>
<forward name="Invalid"
path="/jsp/NoAuthentication.jsp"/>
<forward name="sessionexpired"
path="/jsp/sessionexpired.jsp"/>
</action>


Thanks in advance.

Regards,
Vasu

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      12-14-2006
Vasu wrote:
....
> Let me know if theres any issue with teh code below:


Many, starting with..
....
> <body onunload="doUnload()">


<http://groups.google.com/group/comp.lang.javascript/search?q=onunload&start=0&scoring=d&>

Andrew T.

 
Reply With Quote
 
 
 
 
Vasu
Guest
Posts: n/a
 
      12-14-2006
I anyway found my mistake.

i had not submitted the form.

Heres the jsp code:

<SCRIPT language=javascript>



function doUnload()
{
window.document.forms[0].action="logout.do";
window.document.forms[0].method="post"
window.document.forms[0].submit();
}
</SCRIPT>
this works fine for alt+f4 and the 'X' button too.


Andrew Thompson wrote:
> Vasu wrote:
> ...
> > Let me know if theres any issue with teh code below:

>
> Many, starting with..
> ...
> > <body onunload="doUnload()">

>
> <http://groups.google.com/group/comp.lang.javascript/search?q=onunload&start=0&scoring=d&>
>
> Andrew T.


 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      12-14-2006
Vasu wrote:

Please refrain from top-posting.

> I anyway found my mistake.


The real mistake is depending on 'onunload' to
be called at all.
....
> this works fine for alt+f4 and the 'X' button too.


On your browser, on your OS? That is unfortunate for you..

I would expect clicking the close 'X' button to get rid of
the UA (browser), and any remaining stray windows.

Post your 'solution' to comp.lang.javascript, and watch
them ruin it on a dozen browsers, running on a variety
of OS's.. ( I dare you

Andrew T.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
pyqt4 eric4 generated gui custom dialog open rewonka Python 1 12-15-2009 05:56 PM
insert track reference in mp3 track D@Z Computer Support 1 05-02-2008 03:32 PM
Old certification track vs new certification track. Barkley Hughes MCAD 5 11-12-2006 02:41 PM
how to track iis generated email status Dica ASP General 8 10-04-2005 11:11 PM



Advertisments