Java
  Home arrow Java arrow Page 3 - Creating Your First JSP Page
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Creating Your First JSP Page
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 39
    2005-04-27

    Table of Contents:
  • Creating Your First JSP Page
  • Downloading Tomcat
  • Trying It Out: Testing Tomcat
  • Creating Your First Web Application
  • Exploring a Brief History of Java and the Web
  • Java and the Web
  • The Java Community

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating Your First JSP Page - Trying It Out: Testing Tomcat


    (Page 3 of 7 )

    To test that Tomcat is working, follow these steps:

    1. On Windows, the installer created a group in your Start menu, probably called Apache Tomcat 5.0. To run Tomcat, select the Start Tomcat item in this menu. Alternately, if you prefer the Windows command line, you can execute the following command:

      > %CATALINA_HOME%\bin\startup

      However, because you’ve added %CATALINA_HOME%\bin to the path, you can just type startup, and it’ll work.

      On Linux, you can start Tomcat by executing the following script:

      /usr/local/java/tomcat50/startup.sh

      Because you’ve added Tomcat to the PATH variable, you can simply type startup.sh. 
    2. Once Tomcat is up and running, open your favorite Web browser and navigate to http://localhost:8080. You should see a page something like the one shown in Figure 1-2.


               Figure 1-2.  Tomcat's default welcome page          
    3. Scroll to the Examples box on the left side, click the JSP Examples link, and try out a couple of the sample programs to verify that everything is working properly. If you can’t get the examples to work, double-check that you’ve correctly followed the previous instructions.
    4. At some point, you’ll want to shut Tomcat down. On Windows, you can do this by clicking the Stop Tomcat item in the Start menu. The command-line version of this is%CATALINA_HOME%\bin\shutdown, or just shutdown. Normally, you should avoid simply closing the Tomcat window because that may result in losing data.

    On Linux, execute the script shutdown.sh.

    How It Works: When Things Go Wrong

    If Tomcat didn’t start like it was supposed to, try the following suggestions to figure out where things went wrong:

    1. On Windows, open a command prompt (look for Command Prompt in the Start menu or type cmd or command in the Run option given on the Start menu). Type the command cd %CATALINA_HOME%. On Linux, type cd $CATALINA_HOME. Verify that you’re now in the directory where you installed Tomcat. If not, repeat the step for creating that environment variable in the previous “Configuring Your Environment” section.

    2. Repeat the same process using %JAVA_HOME% or $JAVA_HOME. If you’re not in the correct location, make sure you set up this variable correctly in the “Configuring Your Environment” section.

    3. From the Windows command line, type java and press Enter. If you see a message starting with “‘java’ is not recognized as,” try typing %JAVA_HOME%\bin\java and pressing Enter. If that still produces the same error message, it indicates that Java wasn’t properly installed for some reason.

      Verify that you properly followed the instructions for installing Java, and check the http://java.sun.com Web site for help. If the first command failed but the second one succeeded, repeat the instructions for setting the PATH variable in the “Configuring Your Environment” section.

      The same applies to Linux users, but you’ll need to use $JAVA_HOME in place of %JAVA_HOME% in the previous instructions. Also note that Windows uses a backslash (\) for its paths whereas Linux uses a forward slash (/).
    4. If you’ve made it this far, check and see if Tomcat was properly installed at the path you selected. If not, reinstall it, referring to the http://jakarta.apache.org/tomcat Web site for any special guidance.

    More Java Articles
    More By Apress Publishing


     

    Buy this book now. This article is excerpted from Beginning JSP 2: From Novice to Professional, by Peter den Haan et al (Apress, 2004; ISBN: 1590593391). Check it out at your favorite bookstore. Buy this book now.

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT