Communication Servlet-Applet

Communication Servlet-Applet

Post by Markus Schlege » Thu, 15 Jan 1998 04:00:00



Hi
I've developed a Database-Applet, who accesses a Network-Database with
the Oracle-ThinDriver, and displays the Results in a Table.
I used JBuilder, with JBuilders Database-Beans.
Now, the .jar-File has become to large, to load every time over the
Network (720KB).
To enable Network access, and to save loading-time, I'm looking for a
Server-Side Solution for the DB-Access.
I read about Servlets, and thought that this would solve my Problem. But
I don't understand, how I have to implement a Servlet to communicate
with an Applet.
The HTTPServlet  is used to react on a HTTP-Call and to serve a
HTML-Text. My Book I'm using (TY More Java in 21 Days), tells me to
normally not extend the GenericServlet-Class (why not??).

So how do I implement such a Servlet, how must I call it from the Applet
and how can I receive the Results??

Markus

 
 
 

Communication Servlet-Applet

Post by Skyne » Fri, 16 Jan 1998 04:00:00


The best book which would give you all the answers, with coded
implementation, is
A. Williamson & C. Moran "Java Database Programming : Servlets & JDBC", from
Prentice Hall. You need it. (I bought it personnaly)
Stan

 
 
 

1. Applet Servlet Communication in NES using Object Serialization

Hi , I am having a serious problem trying to send an object to the NES
server using ObjectOutputStream. I create a URL for the servlet
                    and then set the SETDoOutput(true) on the URLConnection
object . Now I create a ObjectOutputStream from the the URLConnection
                    Object and write a simple string to the servlet. The
problem happens when the servlet is trying to read the Object(String). It
generates a
                    streamCorrupted exception as follows:

                    failure (16079): Internal error: exception thrown from
the servlet service function (uri=/servlet/AjayServlet):
                    java.io.StreamCorruptedException: Caught EOFException
while reading the stream header, Stack: java.io.StreamCorruptedException:
                    Caught EOFException while reading the stream header at
java.lang.Throwable.fillInStackTrace(Native Method) at
                    java.lang.Throwable.fillInStackTrace(Compiled Code) at
java.lang.Throwable.(Compiled Code) at
                    java.lang.Exception.(Exception.java:42) at
java.io.IOException.(IOException.java:47) at

java.io.ObjectStreamException.(ObjectStreamException.java:29) at

java.io.StreamCorruptedException.(StreamCorruptedException.java:30) at

java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:727) at
java.io.ObjectInputStream.(ObjectInputStream.java:165)
                    at AjayServlet.doPost(AjayServlet.java:15) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:538) at

javax.servlet.http.HttpServlet.service(HttpServlet.java:611) at
com.netscape.server.http.servlet.NSServletRunner.Service(Compiled
                    Code)

                    This Servlet runs fine on JavaWebServer2.0. The servlet
also runs fine if I write the string using DataInputStream from the applet
and read
                    it on the servlet from DataOutputStream. Iam also able
to return a String object from the server to the applet using
ObjectOutputStream
                    but the problem is with reading the object sent to the
servlet.

                    Please Help.

                    Thanks in advance.

2. Informix and RAID

3. Servlet and Applet Communication

4. connection problem on multiple instance machine

5. http communication between applet and servlet

6. SQL Server shutting down.

7. max connections

8. Applet-Servlet communications

9. Problem with Applet Servlet communication

10. applet to servlet communication

11. Applet-Servlet Communications.