JSP and Applet communication

Source: Internet
Author: User
Tags socket client
JS author/Source: Blueski Compilation


Quite simply, you can use the Java.net.URLConnection and Java.net.URL classes to open a standard HTTP connection and get a connection to the Web server. The server then transmits this information to the servlet in the usual manner. Basically, applets can be viewed as a Web browser, and the servlet does not differentiate between the 2. For the servlet, the applet is just another HTTP customer.

(You can, of course, write a servlet that is invoked specifically by your applet, in which case the servlet does know the difference of 2.) You can also open a serversocket on a client segment TCP port and let your applet open a socket connection. Then you have to design and implement a client segment Socket-level protocol to handle communications. That's what you can write about. For example, a chat applet communicates with a servlet. In short, making a client-side protocol takes more effort than HTTP, but is more flexible. However, the client protocol takes a long time to pass through the firewall. )

To see more detailed information, you can refer to the following pages:

Http://www.sun.com/software/jwebserver/faq/faq.html

Questions C8

Http://www.sun.com/software/jwebserver/faq/faq.html#c8

and C9

Http://www.sun.com/software/jwebserver/faq/faq.html#c9.

Chad Darby has an article with the source program in:

Http://www.j-nine.com/pubs/applet2servlet/index.htm.

Netscape Devedge Online also has a similar article-Applet-to-servlet Communication in enterprise applications

Http://developer.netscape.com/viewsource/index_frame.html?content=fields_servlet/fields_servlet.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.