Home arrow Java arrow Page 2 - What Can JSP Do For Me?

What Can JSP Do For Me?

JDBC, EJB, Java IDL, JNDI, JTS, Servlets, the list goes on. There is limitless possibilities that arise when one is developing web applications using the JSP technology. Read more to get a glimpse at how to develop JSP pages using Tomcat.

Author Info:
By: Ben Shepherd
Rating: 3 stars3 stars3 stars3 stars3 stars / 17
July 28, 2003
  1. · What Can JSP Do For Me?
  2. · Getting Up to Speed with JSP
  3. · Simple JSP Files
  4. · Conclusion

print this article

What Can JSP Do For Me? - Getting Up to Speed with JSP
(Page 2 of 4 )

What we need to do is setup our system so we can build web applications using JSP technology. It would be a great idea to install the latest Tomcat Servlet/JSP Container, if you haven’t already done this.

To get Tomcat, simply go to http://jakarta.apache.org/site/binindex.html and locate the newest version. I decided to go with standard v4.1.24, which includes all optional libraries and an XML parser (Xerces 2.0.1), and can be run on JDK 1.2+. Once you’ve downloaded it, unzip it to the C: directory. I’ll choose the C: anyway.
Now, to set the environment variables, since I’m on Windows XP, it will be the same for Windows 2000. Go to the System folder in the Control Panel. Select the Advanced tab, and click on the “Environment Variables”, then select “System Variables”. Click on the “New” button to add System variables.

Add the following entries into the System registry:

Variable name = CATALINA_HOME
Variable value = C:\jakata-tomcat-4.1.24

Variable name = JAVA_HOME
Variable value = C:\j2sdk1.4.1_01

Now, when you double click on C:\jakarta-tomcat-4.1.24\bin\startup.bat to start Tomcat, the registry will be ready for Tomcat’s requests. To stop Tomcat, simply double click on C:\jakarta-tomcat-4.1.24\bin\shutdown.bat.

Now Tomcat is setup, I go through JSP. The separation of presentation from implementation is one of the key features of JSP. This allows a team, consisting of programmers and page designers, to work independently from each other and produce web applications in a more efficient manner. No longer does a team need to be made up of multi-skilled employees. The team of specialists that can handle their allocated tasks quickly can do the work needed. This saves both time and money.

OK. Enough with the small talk and let us get into some code to demonstrate how JSP would handle a simple request of an IP address. Locate the directory, C:\jakarta-tomcat-4.1.24\ C:\jakarta-tomcat-4.1.24\webapps. This is the folder that you will use to store your JSP files. Create a folder and name it “yadayada”.

Since you have created our new folder, open C:\jakarta-tomcat-4.1.24\conf\server.xml and towards the bottom of the file:

Below the closure of the last Context tab:


and above the closure of the following tabs:


add the following Context element:

<Context path="/yadayada" docBase="yadayada" debug="1" reloadable="true"/>

Now, you need to restart Tomcat. Every time there is a change with the hierarchy you must restart Tomcat. 

How are JSP files Processed?

A lot of server today process JSP files by taking the JSP requests and forwarding them to a JSP processor servlet. Since, we are using Tomcat. You'll notice in C:\jakarta-tomcat-4.1.24\conf\web.xml, that the following can be sited:


as well as 

<!-- The mapping for the JSP servlet -->

This means that requests that come from a url that ends with "*.jsp", that jsp files are mapped as a jsp servlet, which are forwarded to the org.apache.jasper.servlet.JspServlet servlet.


XML is renowned for its proficiency is data representation. It is hierarchal as opposed to relational, so there is no need to learn normalisation. To use JSP with XML is fairly simple. JSP may use SAX and DOM to parse and collect data from a XML file. You may wish to place the data into a  java.util.List object so you can quickly retrieve a needed result. To tidy JSP output, one may use a XSL processor to transform the XML file into HTML code. Not only that, you may convert XML into a variety of other formats like pdf documents using the Java API.

blog comments powered by Disqus

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- 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 ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials