Invoke Servlet from Applet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmanojbaba
    New Member
    • Aug 2007
    • 5

    #1

    Invoke Servlet from Applet

    I want a simple applet prog that has a button.

    On click of that button it must invoke a servlet in IE window (simple hello world program) and close this applet window.

    Pls send me the code for applet...

    Its not any communication between applet and servlet, jus to show the servlet.

    I tried this code...

    public void actionPerformed (ActionEvent ae)
    {
    try{
    AppletContext ac=getAppletCon text();
    URL url = new URL("http://127.0.0.1:8080/Manoj/Baba"); //my servlet address
    ac.showDocument (url,"_blank"); //ac.showDocument (url);
    }catch(Exceptio n e)
    {System.out.pri ntln("Error");
    e.printStackTra ce();}
    }
    }

    but i didnt get the servlet window...:( pls help...
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by dmanojbaba
    I want a simple applet prog that has a button.

    On click of that button it must invoke a servlet in IE window (simple hello world program) and close this applet window.

    Pls send me the code for applet...

    Its not any communication between applet and servlet, jus to show the servlet.

    I tried this code...

    public void actionPerformed (ActionEvent ae)
    {
    try{
    AppletContext ac=getAppletCon text();
    URL url = new URL("http://127.0.0.1:8080/Manoj/Baba"); //my servlet address
    ac.showDocument (url,"_blank"); //ac.showDocument (url);
    }catch(Exceptio n e)
    {System.out.pri ntln("Error");
    e.printStackTra ce();}
    }
    }

    but i didnt get the servlet window...:( pls help...
    You don't open servlets, you open JSPs.

    Comment

    Working...