Are you sure you're send a GET and not a POST?
Doesn't setDoInput specify POST (I can't remember off the top of my head so
this may be complete rubbish),
Kevin Jones
DevelopMentor
www.develop.com
> -----Original Message-----
> From: msaschek@esg-gmbh.de [mailto:msaschek@esg-gmbh.de]
> Sent: 26 May 2000 15:52
> To: tomcat-user@jakarta.apache.org
> Subject: applet doesn't connect to servlet with URLConnection
>
>
> 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
>
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
|