Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Help with Applets and Servlets

  Asked By: Sunil    Date: Aug 29    Category: Java    Views: 626

Could someone show me the path (tutorials, links, reply, etc.) on how to send
information via an applet and then processing on the server-side (I thought a
servlet could do the job) and finally sending back the results to the applet?

I´m reading some tutorials about servlets, but they are all about how to send
and handle forms, not applets.

- there´s no need saying that I´m a java-beginner :)



2 Answers Found

Answer #1    Answered By: Danny Perkins     Answered On: Aug 29

Actually, sending  data to the servlet is the same as if you were going to post
form data. You need to make an HTTP
request to the servlet and then deal with the response which comes back. You
can either do a GET request where all of
the request data is in the URL, but there are URL length limitations. You could
also do a POST request and encode the
data in the HTTP request body. This is probably the most common method.

Here is one article on this issue:


Answer #2    Answered By: Riley-jack Johnson     Answered On: Aug 29

You can use the java.net.URLConnection and java.net.URL classes to open a
standard HTTP connection to the web server. The server then passes this
information to the servlet in the normal way. Basically, the applet  pretends to
be a web browser, and the servlet doesn't know the difference. As far as the
servlet is concerned, the applet is just another HTTP client. See detail from
following URL.
www.j-nine.com/.../Applet2Servlet.html (Applet and
Servlet Communication)
or http://www.jguru.com/faq/view.jsp?EID=157 .

Didn't find what you were looking for? Find more on Help with Applets and Servlets Or get search suggestion and latest updates.