Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use Java for CGI

Posted on 1997-03-05
4
Medium Priority
?
234 Views
Last Modified: 2013-12-25
How can I use Java for CGI under Windows NT 4? How can I run a Java standalone application as if it was a CGI applocation? How can I make the application return HTML to the browser?

Tnx.
0
Comment
Question by:krazy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:krazy
ID: 1827735
Adjusted points to 100
0
 
LVL 4

Expert Comment

by:pluim
ID: 1827736
What is the problem, exactly? How to write a CGI program in
Java, CGI in general, calling the Java program itself, etc.


0
 

Author Comment

by:krazy
ID: 1827737
Edited text of question
0
 
LVL 4

Accepted Solution

by:
pluim earned 300 total points
ID: 1827738
Ok - I assume you know your way around Java and how CGI
programs work in general. If not, I can fill in any details
you might need.

Create your Java CGI program, e.g.

  class HelloWorld {
    public static void main (String args[]) {
      System.out.println("Content-type: text/html\n");
      System.out.println("<HTML><H1>Hello World</H1></HTML>"
      }

This will return a very simple HTML document.

Now, how to launch this program. Create a batch file
called helloworld.bat, containing:
   x:\javapath\java y:\myprog\HelloWorld

Put this file in your /cgi-bin directory.

Create an HTML form with a button that points to
/cgi-bin/helloworld.bat:
  <form method="POST" action="/cgi-bin/helloworld.bat">
  <input type=submit value="Run Programt"><BR>
  </form>

If you want to pass information from the form to the program
(which is generally why you would use forms in the first
place) things are a little more difficult.
Don't want to take the easy way out, but take look at
    http://www.apl.jhu.edu/~hall/java/#CGI
It has four or five really simple examples which should
get you started - and it saves me from having to cut and
paste that code into this little box.


0

Featured Post

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
This article will show, step by step, how to integrate R code into a R Sweave document
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question