你什么意思呀 response.sendRedirect("http://localhost:8080/test/test.jsp");是APPLET调的还是SERVLET调的?

解决方案 »

  1.   

    我的意思是,通过applet的事件响应去调用servlet,然后通过servlet扭转。
    response.sendRedirect("http://localhost:8080/test/test.jsp");在servlet里面
      

  2.   

    还是我自己来解答吧。
    由于applet和servlet是通过流形式来交互。所以可以这样做:
    servlet-side:
    out.println("指定的路径");applet-side:
    /*conncet是URLConnection类型 ,即applet和servlet建立的通信桥
    *通过in去读取servlet返回的数据
    */
       DataInputStream in = new DataInputStream(connect.getInputStream());
       String line;
       while((line=in.readLine())!=null)
      {
          if (line.equals("指定的路径") 
         {
           try 
           {
            getAppletContext().showDocument(new URL("指定的路径"));
            }
           catch (MalformedURLException me) {}
         }
         else 
         {
           // do whatever else
          }
        }