tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msasc...@esg-gmbh.de
Subject applet doesn't connect to servlet with URLConnection
Date Fri, 26 May 2000 14:51:58 GMT
I'm trying to make a connection from my applet in NS4.73 and IE5 to a servlet. I
can call the servlet from the browser by its URL (doGet is called, I've put a
breakpoint) but the request from the applet seems to end up nowhere - doGet is
NOT called. Here's the applet's code:

         URL url = new URL("http://localhost:8080/etk/control");
         String strCommand = URLEncoder.encode("rightText") + "=" +
                             URLEncoder.encode(strInput);
         URLConnection uc = url.openConnection();
         uc.setDoOutput(true);
         uc.setDoInput(true);
         uc.setUseCaches(false);
         uc.setRequestProperty("Content-type", "text/plain"); //or
"application/x-www-form-urlencoded"?
         DataOutputStream dos = new DataOutputStream(uc.getOutputStream());
         dos.writeBytes(strCommand);
         dos.flush();
         dos.close();

and here's the web.xml

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>

    <display-name>ETK Test Application</display-name>
    <description>
     This is a simple web application to test
     servlets and java server pages.
    </description>

    <servlet>
        <servlet-name>ControlServlet</servlet-name>
        <servlet-class>etk.ContrServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>ControlServlet</servlet-name>
        <url-pattern>/control</url-pattern>
    </servlet-mapping>

</web-app>

thanks for any help

Martin



Mime
View raw message