This post is dedicated for you who want to start learning how to create a web application using Java using only simple JSP. I assumed here you already have Java basic knowledge. Please enjoy.
First thing in creating a web application is an editor. I recommend you use Eclipse. This is a powerful and free editor with a lot of plug-ins support. And you may want to add Jetty Launcher plug in to help you continue with this tutorial.
Second, you need JDK(Java Development Kit) use 1.4 version or 1.5, but in here i will use 1.5
Last, you need a servlet container. This is a program that our web application will run in it. You can choose Tomcat or Jetty. I use Jetty,a light weight container.
If you already have all requirements then we will start coding.
Create a new Java project in Eclipse, call it SimpleJSP and set your output folder to simplejsp/WEB-INF/classes.

Create a new file in WEB-INF folder and named it web.xml. Paste this below code,
<?xml”>version = “1.0″ encoding = “utf-8″?>
<web-app>
<description>Simple JSP Application</description>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
After that create new file index.jsp in simplejsp folder and type below code,
<%
out.println(“hello world”);
%>
One thing you must remember is, all code in your page that is between <% and %> will be take it as a Java code, so if you want to write a HTML tag inside <%%> then you must use out.println syntax. But if it’s outside the <%%> then you can just type the HTML tag like the usual HTML page.
Below image is what your project will look like,

Now we will try to run our web application. Choose Run menu and click Open Run Dialog, configure Project, Jetty Home, web root dir. You can see in picture below as an example.

Click run, open your browser and type http://localhost:8080/index.jsp
I predict this will be your output,

Don’t worry.. i know this will happen. It is because we need to link tools.jar file from jdk so eclipse can compile our jsp file.
Right click in your project and choose Build Path->Add External Archieve then select your tools.jar file, it is located in your [jdk home]\lib folder

After that restart your Jetty, and refresh the index.jsp page.. voilla..Congratulations you already create your first jsp page.

In the next post, we will continue with handling user input.
Thanks.