No, that isn't true. I use ServletExec and when change the call DbServlet in
TestServlet (an example from ServletExec) it works fine.
It's something in the DbServlet what send data the applet can't read with the
InputStream.

But what?

Marjon





[EMAIL PROTECTED] on 02/12/2000 01:35:45 PM

Please respond to [EMAIL PROTECTED]

To:   Marjon van den Broek/mint@mint
cc:

Subject:  RE: Applet to Servlet communication




 The problem is where you specify the url for the DbServlet...you can try to
set the url as: http://localhost:8080/servlet/DbServlet...and have set the
servlet classes directory in the servlet engine...

 hope this helps, javier.

Hello,
I have a problem with applet to servlet communication. I try to get
information from a Acces database.

I get this message :
java.io.FileNotFoundException: localhost:80//servlet/DbServlet
 at com/ms/net/wininet/http/HttpInputStream.connect
(HttpInputStream.java)
 at com/ms/net/wininet/http/HttpInputStream.<init>
(HttpInputStream.java)
 at com/ms/net/wininet/http/HttpURLConnection.createInputStream
(HttpURLConnection.java)
 at com/ms/net/wininet/WininetURLConnection.getInputStream
(WininetURLConnection.java)
 at com/ms/net/wininet/http/HttpPostBufferStream.close
(HttpPostBufferStream.java)
 at java/io/FilterOutputStream.close (FilterOutputStream.java)
 at DbApplet.executeQuery (DbApplet.java:56)
 at DbApplet.actionPerformed (DbApplet.java:74)
 at java/awt/Button.processActionEvent (Button.java)
 at java/awt/Button.processEvent (Button.java)
 at java/awt/Component.dispatchEventImpl (Component.java)
 at java/awt/Component.dispatchEvent (Component.java)
 at java/awt/EventDispatchThread.run (EventDispatchThread.java)

The problem is probably this statement in the applet
 InputStreamReader in = new InputStreamReader(uc.getInputStream());

This is the Applet code:
       URL url = new URL("http://localhost/servlet/DbServlet");
         String qry = URLEncoder.encode("qry") + "=" +
                             URLEncoder.encode(qryString);

         URLConnection uc = url.openConnection();
         uc.setDoOutput(true);
         uc.setDoInput(true);
         uc.setUseCaches(false);
         uc.setRequestProperty("Content-type",
                             "application/x-www-form-urlencoded");

         DataOutputStream dos = new
DataOutputStream(uc.getOutputStream());
         dos.writeBytes(qry);
         dos.flush();
         dos.close();

        InputStreamReader in = new
InputStreamReader(uc.getInputStream());

         int chr = in.read();
         while (chr != -1) {
            taResults.append(String.valueOf((char) chr));
            chr = in.read();
         }
         in.close();

This is the Servlet code:
   public void doGet(HttpServletRequest req, HttpServletResponse res)
                              throws ServletException, IOException {
      PrintWriter out = res.getWriter();
      res.setContentType("text/html");

      if (initfault != null && initfault != " ")
        out.println(initfault);

     String qry = req.getParameter("qry");

    try {
         Statement s = dbCon.createStatement();
         ResultSet rs = s.executeQuery(qry);
         while (rs.next()) {
            out.println(rs.getString(1) + " -  " + rs.getString(2));
            out.println(rs.getString(3));
            out.println ("");
         }
      } catch (SQLException e) {
         out.println(e.toString());
         return;
      }
      out.println();
      out.close();
   }

Thanks in advance
Marjon

________________________________________________________________________
___
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

___________________________________________________________________________
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

Reply via email to