Oct 042009
 

A “hello world” program has become the traditional first program that many people learn. Here’s i’ll show you how to print “Hello World” in A web page.

Using HTML

<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
   <HEAD>
      <TITLE>
         Hello World
      </TITLE>
   </HEAD>
<BODY>
   <P>hello world</P>
</BODY>
</HTML>

Using C cgi

#include <stdio.h>
int main(void) {
  printf("Content-Type: text/plain;charset=us-ascii\n\n");
  printf("Hello world\n\n");
  return 0;
}

Using PHP

<?php
    Print "Hello, World!";
?>

Using PERL

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello World.\n";

Using Python

#!/usr/bin/python
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'

Using  javascript

<script type="text/javascript">
document.write('<b>Hello World</b>');
</script>

Using Java servlet

package test;

import java.io.*;

import javax.servlet.http.*;
import javax.servlet.*;

public class HelloServlet extends HttpServlet {
  public void doGet (HttpServletRequest req,
                     HttpServletResponse res)
    throws ServletException, IOException
  {
    PrintWriter out = res.getWriter();

    out.println("Hello, world!");
    out.close();
  }
}

Using JSP

<%@ page contentType="text/html;charset=WINDOWS-1252"%>
<HTML>
  <HEAD>
    <TITLE>Hello World</TITLE>
  </HEAD>
    <BODY>
       <P>
          <B>
           <% out.println(" Hello World"); %> !
          </B>
       </P>
     </BODY>
</HTML>

Using ASP

<HTML>
  <HEAD>
    <TITLE>Hello World</TITLE>
  </HEAD>
    <BODY>
    <P>
          <B>
           <% Response.Write("Hello World!") %>
          </B>
       </P>
     </BODY>
</HTML>

Using BASH

#!/bin/bash
echo -e "Content-type: text/html\n"
STR="Hello World!"
echo $STR

And many more Language that i don’t know yet..

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.