JSP Hello World

Share |

This sample code or example displays "hello world" in the browser using JSP

JSP can be learned very easily. This is just the beginning to learn this exciting language. This simple page contains a JSP program and it outputs on browser in running state. This given program of JSP illustrates you how to print simple "Hello World!" string on the browser through the server side code (provided by JSP).

This program also contains HTML (Hypertext Markup Language) code for designing the page and the contents. Following code of the program prints the string "Hello World!" by using <%="Hello World!" %> while you can also print the string by using out.println("Hello World!") in the <% and %> JSP tags.

Here is the code of the program "hello.jsp":

 <head><title>Hello World JSP Page.</title></head>
  <font size="10"><%="Hello World!" %></font>


Running or Executing hello.jsp

Note You must install tomcat or any other web-server which supports JSP.
Here I will explain how can you run hello.jsp using tomcat.
- Put hello.jsp in the directory [tomcat install directory]/webapps/ROOT/
- Then start tomcat server using [tomcat install directory]/bin/startup.bat on Windows platforms or [tomcat install directory]/bin/ on Unix or Linux platforms.
- Now open you web-browser and open URL "http://localhost:8080/hello.jsp" and you can see "Hello World!" as output in your web-browser.

Share |

No comments yet

Hot Topics

My Headlines