Category Archives: Servlet & JSP

Servlet : Hello World

Developing Simple Web Application (Java)
==================================
1. Software Done

2. Install so first we will install java

3. We will unzip the tomcat

4. We have to do some configuration.

5. We will develop an application

Advertisements

Leave a comment

Filed under Servlet & JSP

Instantiation of Tomcat 6.0 & Running Servlet

Minimum requirement: JDK 1.6 & Standard Browser.
=======================================

1. Download Apache Tomcat form :http://tomcat.apache.org/download-60.cgi & extract the Zip file

2. Environment variable:
a. CATALINA_HOME H:\Software\apache-tomcat-6.0
b. JAVA_HOME C:\Program Files\Java\jdk1.7.0
c. PATH H:\Software\apache-tomcat-6.0\bin
d. Classpath H:\Software\apache-tomcat-6.0\lib\servlet-api.jar; H:\Software\apache-tomcat-6.0\lib\jsp-api.jar

3. Modify this file:

H:\Software\apache-tomcat-6.0\conf\tomcat-users.xml

4. cmd => startup or shutdown

4.1 cmd => startup

5. http://localhost:8080

Running Servlet in Tomcat
======================

Simple Application (Servlet):

1. Create a folder inside the webapps (vinod)

H:\Software\apache-tomcat-6.0\webapps\vinod

2. Create a folder inside vinod => WEB-INF (H:\Software\apache-tomcat-6.0\webapps\vinod\WEB-INF)

3. Create the web.xml file inside WEB-INF (H:\Software\apache-tomcat-6.0\webapps\vinod\WEB-INF\web.xml)

First_Class_File
First_Class_File

First_Class_File
/First_Class_File

4. Create a folder inside the WEB-INF (Classes)
=> H:\Software\apache-tomcat-6.0\webapps\vinod\WEB-INF\classes

5. Create the Java File inside the WEB-INF => H:\Software\apache-tomcat-6.0\webapps\vinod\WEB-INF\classes

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class First_Class_File extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
{
PrintWriter out=response.getWriter();

out.println(“Hello Servlet”);

}

}
6. Compile the Java file and store
7. http://localhost:8080/vinod/first

Leave a comment

Filed under Servlet & JSP