Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-16-2003, 02:47 PM   #1 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,175
Belisarius is on a distinguished road
Brief popup under IE

I think this is a javascript under IE problem, as I got it to work successfuly under Opera.

I want to have a locking mechanism for certain webpages so that only one person can have interactive access at any given time. Of course, I want them to give up the lock upon leaving the page. The best way I could think of doing this (via JSP) was to popup a window that contained the release code via the onUnload function.

Here are the relevant code snippets:

On the page in question:
Code:
 <snip>

function releaseLock(){
      window.open("releaseLock.jsp?lock_name=<%=request.getParameter("id")%>", "Release Locks");
}

<snip>

<body onUnload="releaseLock()">
Here's the release lock popup code:

Code:
<jsp:useBean id="user" class="dec.common.beans.UserBean" scope="session" />

<%@ page import="dec.common.locks.*" %>
<%@ page import="dec.common.authentication.*" %>

<%
  String lock = request.getParameter("lock_name");
  if(lock != null){
    lock = lock.trim();
    LockMap.getInstance().release(lock, user.getUser().getUID());
  } // If lock == null, do nothing.  Something broke, and the lock that was suppose
    // to be released will have to expire.
%>
  <html>
    <head>
    </head>
    <body onLoad="window.close()">
     <a href="javascript:void(0)" 
       onClick="window.close()"</a>
    </body>
  </html>
Now, the problem is that when I close the window, the popup doesn't seem to open, and the lock remains in place. Again, this happens under IE, but not Opera. I would have tested it under Mozilla, but one of the Javascript operations (refering to a window's opener) didn't work.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 10-20-2003, 02:03 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,175
Belisarius is on a distinguished road
Fixed my own problem. Left off a tailing '>'
__________________
GitS
Belisarius is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
someone please help kickerman97 Java 3 10-19-2004 04:19 PM


All times are GMT -8. The time now is 12:28 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting