Professional Documents
Culture Documents
article=2001060801&page=1
• JSP uses Java. Java is by far one of the most popular programming
languages on the web. Its simpler syntax and 'write once run anywhere'
capability makes it THE server side programming language of choice. So JSP
pages and Java applications that you create will run on almost all major
operating systems e.g. Windows, UNIX, Mac etc. You don't need to create
separate apps for separate platforms.
• JSP is part of J2EE. J2EE (Java 2 Enterprise Edition) is one of the most
popular models used to develop Enterprise level applications. J2EE is
supported by software giants like Sun Microsystems, BEA, Oracle, IBM etc.
So once you learn to program JSP, you can extend your skills to learn other
Java technologies to become what is called, an Enterprise Software
Developer.
• Networking is built into Java. Java's inherent support for networking
makes it an ideal langauge for the internet.
I can continue to write more and more reasons as to why to use Java (JSP)
but then it will make my article longer than I would like, so I suffice with the
above features. Once you'll learn Java (JSP), you'll come to know what I
mean when I say 'Java is the best language for the internet'.
Continue reading to see the basic steps required in the installation of Tomcat
6.0 Servlet Container / JSP Engine. I'll be using Tomcat in the later articles
and tutorials on 'Server Side Java' so you need to have it installed on your
system.
You'll need to have JDK 1.6 (or simply 'JDK 6', as it is called on Sun's
download page) installed on your system in order for Tomcat 6.0 to work
properly. If you don't already have it, you can get it from java.sun.com.
• CATALINA_HOME : C:\apache-tomcat-6.0.14
• JAVA_HOME : C:\Program Files\Java\jdk1.6.0_03
Under Windows 95/98, you can set these variables by editing C:\autoexec.bat
file. Just add the following lines and reboot your system :
SET CATALINA_HOME=C:\apache-tomcat-6.0.14
SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_03
Running Tomcat 6.0
Ok now, lets start Tomcat by running the C:\apache-tomcat-
6.0.14\bin\startup.bat batch file. Tomcat server will start and print some
status messasge. Now point your browser to http://localhost:8080 and you
should see the default Tomcat home page. To shutdown the server run
C:\apache-tomcat-6.0.14\bin\shutdown.bat batch file.
Go to C:\apache-tomcat-6.0.14\webapps\ folder and create a new directory
with the name of "star". You can give it any name you want but for this
example we'll stick with "star".
Now create a new file and save it as 'index.jsp' in the "star" directory
created above. Copy the following text into 'index.jsp' file and save it :
<html>
<head>
<style>p { font-family:tahoma; font-size:14pt; }</style>
</head>
<body>
<%
String name = "Faisal Khan";
%>
<p>Hello <%= name %>!</p>
</body>
</html>
Above page appears to be a simple HTML page except one line of Java code
between the <% and %> tags. These work the same way as <% %> tags in
ASP. You can add server side Java code between these tags. In this case we
simply declared a variable 'name' of type String ( simple text ) and initialized
it with a value of "Faisal Khan", you can substitute your own name if you
want.
<%
String name = "Faisal Khan";
%>
Summary
In this article I introduced JSP as a new, efficient, scalable and secure technology to develop
web applications. I then walked you through the steps of downloading and installing Tomcat
6.0.14. Tomcat is Java web container ( Servlet Container and JSP Engine ) available for free
from Apache Software Foundation. In the end we built and tested a simple JSP page
'index.jsp'.
@@@@@@@@@@@@@@@
http://www.roseindia.net/servlets/HowToRunAServlet.shtml
• Download and Install the tomcat server: Install the tomcat server in a directory
in which you want to install and set the classpath.for the variable JAVA_HOME in the
environment variable. To get details about the installation process and setting the classpath
click the link Tomcat installation.
• Set the class for the jar file: Set the classpath of the servlet-api.jar file in the
variable CLASSPATH inside the environment variable by using the following steps.
@@@@@@@@@@@@@@
http://tomcat.apache.org/download-60.cgi
Binary Distributions
• Core:
http://localhost:8080/ravi/jsp/pro1.jsp
CATALINA_HOME :
@@@@@@@@@@@@http://www.codingforums.com/archive/index.php/t-
114401.html
First, make sure that tomcat is currently running
Once there, you will be able to set a default tomcat page. if you cannot see it...it could
be due to any of the following reasons:-
1- The port is not 8080
2- Tomcat is not currently running
C:\Tomcat\conf\server.xml
If you don't like adding port 8080...or http://localhost:8080 you can change it to
80...and then you can write http://localhost
Another important file...you should look at is the following
C:\Tomcat\conf\tomcat-users.xml
Well..if you want to access the Tomcat Manager...then you should add the following
two line
<role rolename="admin"/>
<user username="YOUR_USER_NAME_HERE" password="YOUR_PASSWORD_HERE"
roles="admin,manager"/>
As for seeing your project, depending on what you have called your project...you
should be able to see at http://localhost:8080/PROJECT_NAME
Cheers,
Ess