Pages

Tuesday, 2 October 2012

Apache Tomcat Server Configuration for JSP Website in windows localhost

JSP Project Deployment on Apache Tomcat Server:

          
                For those who are beginner to web development and want to work on web-technology which is JAVA. The first question arise in our mind is,  What is JAVA and what is it used for? In simple way, JAVA is a Technology which have contributed in almost all Technologies in different ways in the form. Here, as we will discuss about the web-technology, so in contributes to that JavaScript, JSP, Applet, JQuery etc. these are most commonly used in web development.
   
Now, we will discuss about the JAVA based web development which is JSP(JAVA Server Page). JSP is the technology used for developing website. As security concerns JSP provide reliability and bit more security than other web development technologies. The reliable in the sense of browser support and its platform  independent properties. 

This tutorial is for those who wants to know, how to deploy JSP websites on Apache Tomcat Server manually on the Localhost/PC/Laptop. Because in IDE, we creates project and deployment on local server will be take care by that IDE. at the end of this tutorial, you will have deep knowledge about the dependencies between Java class files, JSP files and other HTML files, how they communicate and all.

JSP Project Directory on Server:


Before we go ahead, We have to prepare server environment and install required software tools:
1) JDK :
                 As JSP is a Part of JAVA you will need JDK for that.
                 You can download and install JDK from here.

2) Server : Apache Tomcat

                 Apache Tomcat server mostly used for checking standalone application. and you can  download and install it from here.

during the installation you will need to note something,
                
a) port number(here 8080)
b) admin username
c) admin password 

admin username and password will be needed for accessing websites.

Package Structure on Server(Folder Structure):


1.) Create New Folder(For Example :"ELECTRICITY") in directory "C:\Program Files\Apache Software Foundation\Tomcat\webapps\"
           
              - Put all your .jsp, .hrml, .mdb(Database file) and images in ELECTRICITY Folder.
              - There must be "index.jsp" or "index.html" page as your starting page name.

2)   In "ELECTRICITY" folder Create New Folder named as "WEB-INF"(Without this folder you may not run your project properly.
         
             - If your Project has web.xml file then put it in the "WEB-INF" Folder.
             - This xml file is generally for mapping of Java Servlet to respected class/java for data processing.

3)  In "WEB-INF" folder Create New Folder named as "classes"(Without this folder you may not run your project properly.
         
              - Put all .class or .java file in "classes" folder.

4)   Sample folder Structure You can Download From here.




How to Run JSP Project????


1) Start Apache Server from the Directory "C:\Program Files\Apache Software Foundation\Tomcat\bin\"

2)  Now Open Browser and write "http://localhost:8080/" and press ENTER.(8080 is your port number)

3) Apache home page is open and you can see there  "Tomcat manager" or "Apache manager". Click it and proceed to authentication.

4)   After authentication you can see your project name in left panel.

5)   By  clicking on your project, your index.jsp or index.html page will be open in  browser.

Now, You have knowledge about, how deployment of JSP website is done on Apache Tomcat Server on Localhost.