Click here to Skip to main content
15,891,033 members
Home / Discussions / Web Development
   

Web Development

 
Questionsending data to script on web server Pin
Danzy8321-Jul-12 11:42
Danzy8321-Jul-12 11:42 
AnswerRe: sending data to script on web server Pin
Sandeep Mewara21-Jul-12 19:58
mveSandeep Mewara21-Jul-12 19:58 
AnswerRe: sending data to script on web server Pin
David Mujica23-Jul-12 2:22
David Mujica23-Jul-12 2:22 
GeneralRe: sending data to script on web server Pin
Danzy8323-Jul-12 4:34
Danzy8323-Jul-12 4:34 
GeneralRe: sending data to script on web server Pin
Andrei Straut23-Jul-12 9:04
Andrei Straut23-Jul-12 9:04 
GeneralRe: sending data to script on web server Pin
David Mujica23-Jul-12 11:05
David Mujica23-Jul-12 11:05 
AnswerRe: sending data to script on web server Pin
jkirkerx23-Jul-12 10:17
professionaljkirkerx23-Jul-12 10:17 
QuestionCGI in Java - Legacy but interesting (for educational purposes) Pin
ppign20-Jul-12 23:15
ppign20-Jul-12 23:15 
I folks:

I know that CGI is jurassic and before all of you call me lunatic, I must say that this question is only for EDUCATIONAL PURPOSES (in real cases I use JSP).

I'm trying to code a "Hello World" CGI in Java, and I'm unsucessful.

So I try the same job in C#. Both programs (C# and Java) are totally equal (line by line). The C# works and the Java don't.

Here's the code in C#:


XML
namespace CGI_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Content-Type: text/html\n"); // the extra "\n" is needed
            Console.WriteLine("<html>");
            Console.WriteLine("<head>");
            Console.WriteLine("<title>CGI - C#</title>");
            Console.WriteLine("</head>");
            Console.WriteLine("<body>");

            Console.WriteLine("<h1>Hello World !</h1>");

            Console.WriteLine("</body>");
            Console.WriteLine("<html>");
        }
    }
}


In the browser URL I wrote: http://localhost/CGI_CSharp.exe and BINGO! The C# code WORKS !

Now the same code in Java:


XML
public class CGI_Java
{
    public static void main(String[] args)
    {
        System.out.println ("Content-Type: text/html\n");
        System.out.println ("<html>");
        System.out.println ("<head>");
        System.out.println ("<title>CGI - Java</title>");
        System.out.println ("</head>");
        System.out.println ("<body>");

        System.out.println ("<h1>Hello World !</h1>");

        System.out.println ("</body>");
        System.out.println ("</html>");
    }
}


Now I've tried the URL:

http://localhost/java.exe%20CGI_Java

(as you know, the %20 is the space => (http://localhost/java.exe CGI_Java)

I get:

HTTP 404.0 - Not Found

So, I try again, now with a batch file (CGI_Java.bat) with a single line of text:

java.exe CGI_Java (content of the CGI_Java.bat)

And now, I try the URL:

http://localhost&/CGI_Java.bat

Now the browser shows:

C:\inetpub\wwwroot>java.exe CGI_Java

This is the prompt followed by the command I wrote in the batch file.

Can someone help me?

Thanks in advance.
AnswerRe: CGI in Java - Legacy but interesting (for educational purposes) Pin
Trak4Net21-Jul-12 11:22
Trak4Net21-Jul-12 11:22 
QuestionContact me Web page Pin
flinchy319-Jul-12 4:51
flinchy319-Jul-12 4:51 
AnswerRe: Contact me Web page Pin
R. Giskard Reventlov19-Jul-12 5:38
R. Giskard Reventlov19-Jul-12 5:38 
GeneralRe: Contact me Web page Pin
flinchy324-Jul-12 3:06
flinchy324-Jul-12 3:06 
GeneralRe: Contact me Web page Need Help Pin
flinchy326-Jul-12 4:35
flinchy326-Jul-12 4:35 
QuestionInner Exception while creating an instance of java web service in .net client Pin
Anuradhaanu18-Jul-12 19:01
Anuradhaanu18-Jul-12 19:01 
AnswerRe: Inner Exception while creating an instance of java web service in .net client Pin
Sandeep Mewara18-Jul-12 19:52
mveSandeep Mewara18-Jul-12 19:52 
QuestionRebinding Problem with Jquery knockout.js with MVC Pin
Vimalsoft(Pty) Ltd18-Jul-12 5:08
professionalVimalsoft(Pty) Ltd18-Jul-12 5:08 
AnswerRe: Rebinding Problem with Jquery knockout.js with MVC Pin
Vimalsoft(Pty) Ltd18-Jul-12 22:37
professionalVimalsoft(Pty) Ltd18-Jul-12 22:37 
Generalinstance of a soap web service not creating Pin
Anuradhaanu18-Jul-12 2:40
Anuradhaanu18-Jul-12 2:40 
Questionjava soap webservice and .net client validating service using soap headers Pin
Anuradhaanu17-Jul-12 18:42
Anuradhaanu17-Jul-12 18:42 
SuggestionRe: java soap webservice and .net client validating service using soap headers - Repost Pin
Richard MacCutchan17-Jul-12 21:54
mveRichard MacCutchan17-Jul-12 21:54 
Questiontracing Pin
hossam jarrah16-Jul-12 23:18
hossam jarrah16-Jul-12 23:18 
GeneralRe: tracing Pin
Sandeep Mewara16-Jul-12 23:33
mveSandeep Mewara16-Jul-12 23:33 
GeneralRe: tracing Pin
Albert Holguin18-Jul-12 16:03
professionalAlbert Holguin18-Jul-12 16:03 
QuestionHow to Bind Data with Knockout Pin
Vimalsoft(Pty) Ltd16-Jul-12 7:22
professionalVimalsoft(Pty) Ltd16-Jul-12 7:22 
QuestionREST and WCF Pin
Xarzu15-Jul-12 20:34
Xarzu15-Jul-12 20:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.