Bhaskar,
    To the best of my knowledge, this approach outlined below has several
minor flaws.  First, it is not possible for the javascipt self.slose()
method to throw a java exception; That exception is likely being thrown by
your action class.  Second, in order to acomplish the functionality that it
appears you are describing, ie. submitting a form in a popup window and then
closing the window, you would need to do something like the following:

function setFilter() {
    document.PipelineFilterForm.submit();
}
<html:button value="Set filter" onclick="javascript:setFilter();"
property="submitButton"/>

You may also consider using a regular html:submit button and avoid this
javascript above all together (preferable)
and then AFTER the form is submitted, have your action class forward to a
new generic page with some very simple code like
<html>
<head>
    <script>
    function closeWindow(){
        self.close();
    }
    </script>
</head>
<body onload="closeWindow()">
</body>
</html>

OR

<html>
<head>
    <script>
    function closeWindow(){
        self.close();
    }
    closeWindow();
    </script>
</head>
</html>

Not sure if this is the best approach, but it ensures that your action class
succeeds before your window closes, so if there is an error you can forward
to a different page while still inside of the popup window.

Just my 2 cents,
Adam Grohs

----- Original Message -----
From: "Bhaskar Gopalan" <[EMAIL PROTECTED]>
To: "Struts Group (E-mail)" <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 4:14 PM
Subject: self.close() exception


> Hi,
> I'm trying to close a window from a javascript function and getting this
> error:
>
> java.net.SocketException: socket closed (code=0)
> java.lang.Throwable(java.lang.String)
> java.lang.Exception(java.lang.String)
> java.io.IOException(java.lang.String)
> java.net.SocketException(java.lang.String)
> int java.net.SocketInputStream.socketRead(byte [], int, int,
> java.net.SocketImpl, java.io.FileDescriptor)
> int java.net.SocketInputStream.read(byte [], int, int)
> int java.net.SocketInputStream.read()
> java.lang.String java.io.DataInputStream.readLine()
> void
>
com.ibm.servlet.engine.http_transport.HttpTransportHandler.handleConnection(
> java.net.Socket)
> void
> com.ibm.servlet.engine.http_transport.HttpTransportHandler.run()
> void java.lang.Thread.run()
>
> The code is:
> function setFilter() {
> document.PipelineFilterForm.submit();
> self.close();
> }
>
> <html:button value="Set filter" onclick="javascript:setFilter();"
> property="submitButton"/>
>
> Pls help.
>
> Thnx,
> Bhaskar
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to