hello gwen,
it should be at Applet calling the Servlet & not vice-versa as Applets, by
themselves, cannot talk to the server. they do so with the help of Streams.
you have to first make an applet. in the applet, specify an object of the URL
class, the URLConnection class & of course, the DataInputStream class. the
URLConnection class will make the connection b/w the applet & servlet.
well, you must go by the following steps:
1. create an applet calling the servlet.
2. create a servlet performing yr jdbc tasks.
3. create an html page calling the applet.
4. if u r using Java Web Server 2.0, compile the applet file & the servlet
file.
5. copy the applet.class file & the html page in the "public_html" folder.
6. copy the servlet.class file in the "servlets" folder.
7. in yr browser, call "http://hostname:port/html.html", the html page that u
created & copied in the pubic_html folder.
but, u must remember to use response.setContentTYpe("text/plain") in yr
servlets file. this is b'coz applets communication is in simple ASCII format.
well, i hope to have clarified some of yr doubts. any suggestions on this will
be appreciated.
best regards,
amit bhatia.
"S.A.Pamungkas" <[EMAIL PROTECTED]> wrote:
> Hi Gwen
>
> Make html file including <APPLET> tag.
> In applet use ( for example )
> URLConnection con = url.openConnection();
> to connect servlet.
>
> There are nice samples and explanation about
> applet-servlet communication in Jasson Hunter's book (
> Java servlet programming ).
>
> Or please go to
> http://www.j-nine/pubs/applet2servlet/index.htm
>
> Regard,
>
> - pamungkas (sajip) -
>
> --- meh_PY <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I am a bit confuse with all the reading that I have
> > read
> > Shd it be applet calls servlet or vice versa?
> > In addition, there is a need for me to accesss data
> > from the database. So, which one shd come first &
> > who one to call who?
> > database called by -> JDBC ???
> > JDBC called by -> apple / servlet ???
> > If applet is the one to call servlet, does it mean
> > that i shd have a html file that calls applet & have
> > something in the applet file that calls servlet. How
> > can i connect the above few?
> >
> > I have written a testing program that has servlet to
> > call applet & view the pg using the servlet.
> > That is, http: host name:port/servlet/servlet-name
> > However, there is a 'applet class not found'
> > message.
> > Is it the problem with the way i have the servlet
> > calling the applet?
> >
> > Pls render help.....thks!!!
> >
> > :)Gwen
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
___________________________________________________________________________
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