Hi, I need to have a servlet open a new browser window and have an applet run inside this new window. I searched this list archive and did indeed find this very same question back in 1998. After trying the posted suggestion, I'm not successful, so I'm showing below what I did in the hope that someone can advise me. (BTW, my webserver is Apache v1.3.17, and I'm using Tomcat v3.1 on Solaris 2.7; my browser is Netscape v4.76, also on Solaris 2.7) 1) User enters this URL in browser: http://mywebserver/TEST/index.html where index.html has a link to my servlet, like this: <a href="http://mywebserver/examples/servlet/TestServlet">TestServlet</a> 2) User now clicks on the link and TestServlet is invoked because the System.out.println string shown in the code below is displayed in my tomcat console: // TestServlet import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class TestServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { // I GET THE LINE BELOW SO PATHS ARE CORRECT, TOMCAT WORKS... System.out.println("TestServlet"); resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); String script = "<script>parent.location=\"http://shaggy.lbl.gov/w ebOwl/simpleFactory/index.html\";\nvar w = window.open(\"http://" + req.getHeader("Host") + "/examples/servlet/AppletServlet\", \"TEST\", \"width=700,height=700 \");</script>"; System.out.println("TestServlet: writing script: " + script); out.write(script); out.close(); } } The parent.location DOES display the correct page. Following someone's early answer, I supply as argument 1 to window.open() the path to a servlet, AppletServlet. I get a new window that is empty--ok, I haven't written anything to the window's document yet. AppletServlet is indeed invoked because I get the 2 System.out.println strings in the code below: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class AppletServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { // THIS STRING IS DISPLAYED SO WE GOT HERE!! System.out.println("AppletServlet"); resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); String script = "<html><head><title><Instant Messaging></title></head><b ody><center><applet code=TestApplet.class codebase=/TEST align=baseline width=70 0 height=700</applet></center></body></html>"; //WHEN UNCOMMENTED AND RECOMPILED, THIS STRING IS DISPLAYED IN THE //NEW WINDOW!!! //String script = "An Applet should run here"; // I DO get the following printout System.out.println("AppletServlet::writing script: " + script); out.write(script); out.close(); } } BUT the TestApplet does not get loaded... The codebase is correct and I'm getting no errors. Here is my actual output on my tomcat window: ____________________________________________ mperry@shaggy(293)>TestServlet TestServlet: writing script: <script>parent.location="http://shaggy.lbl.gov/webOwl/simpleFactory/index.html"; var w = window.open("http://shaggy.lbl.gov/examples/servlet/AppletServlet", "TEST", "width=700,height=700");</script> AppletServlet::writing script: <html><head><title><Instant Messaging></title></head><body>< center><applet code=TestApplet.class codebase=/TEST align=baseline width=700 height=700</applet></center></body></html> _________________________________________________ Please help if you can... Thanks very much, Marcia -------------------------------------------- Marcia Perry [EMAIL PROTECTED] Lawrence Berkeley National Laboratory WORK# (510) 486-6786 1 Cyclotron Road FAX# (510) 486-6363 Berkeley, CA 94720 MS: 50A-3111 ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
