Explain how to send data from my Java program to a CGI program.There are two methods of sending data from Java program to a CGI Program:
a.) The first method is that we can use CGI scripting on both client and server by using Java.
The client-side part covers using GET and POST from applets to talk to CGI programs. The server-side part covers implementing CGI programs in Java that handle GET and POST (regardless of whether the client uses HTML forms or applets), and also includes a URL decoder and CGI form parser in Java.
b.) The second method is by using Servlets and JSP.
Servlets are Java technology's answer to CGI programming. They are programs that run on a Web server and build Web pages. Java servlets are more efficient, easier to use, more powerful, more portable, and cheaper than traditional CGI and than many alternative CGI-like technologies.
Java Server Pages (JSP) is a technology that lets you mix regular, static HTML with dynamically-generated HTML. Many Web pages that are built by CGI programs are mostly static, with the dynamic part limited to a few small locations.