Skip to Content
author's profile photo
Former Member

Display static html page in popup

Hello all,

I have to display a popup that alerts the user to the fact that a file has been written successfully (or not). The popup has to auto-close after 2 seconds or so; so that the user doesn't have to always press the "OK" button like with javascript alert. If there is a way to close the javascript alert box I'd be happy to know though.

So I thought the javascript;

win = window.open('',.....

followed by;

win.document.write('<html>.......

would be the way to go. I see now that it isn't. I guess because the popup opens on the client while the code is run on the server and this causes a permissions problem.

Then I figured that I could add the html file to my .par and open it locally from my java code. I can't seem to get that working however.

I also figure that since the J2EE server is a server then there must be someplace there I can put an html file and then just call it over http.

Any help with this will be greatly appreciated.

Thanks for your time,

Patrick.

Message was edited by: Patrick O'Neill

So that I could mark it as a question 😉

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Posted on Dec 20, 2004 at 05:52 AM

    Hi Patrick,

    Could you not simply have the code launch a new URL after the file save?

    You could host a very simple website with the one page that you want to show, have the code launch the URL and use the below script within the page that you launch?

    <body onLoad="setTimeout(window.close, 3000);">

    Hope this helps.

    Cheers

    Daniel

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Feb 28, 2005 at 09:53 AM

    Hi

    I had the same problem this morning: I wanted to include an external javascript, located somewhere in the par-file. The solution in JSP (or Java) to produce the path dynamically and correctly in all cases is the following:

    <%
    String componentName = componentRequest.getComponentContext().getComponentName();
    String baseURL = componentRequest.getWebResourcePath(componentName);
    %>
    <script language="JavaScript" src="<%= baseURL %>/scripts/MyScript.js"></script>

    hope this helps anyone!

    regards

    nicola

    Add comment
    10|10000 characters needed characters exceeded