Home arrow Reviews arrow Page 2 - New Technologies and What They Mean To You: Part 3
REVIEWS

New Technologies and What They Mean To You: Part 3


In part 2 of this series Jeremy talked about PHP, ASP and ColdFusion. In this article he explains what JSP and CGI are, providing advantages, disadvantages and examples for each.

Author Info:
By: Jeremy Wright
Rating: 4 stars4 stars4 stars4 stars4 stars / 5
February 04, 2003
TABLE OF CONTENTS:
  1. · New Technologies and What They Mean To You: Part 3
  2. · JSP
  3. · CGI
  4. · Conclusion

print this article
SEARCH DEVARTICLES

New Technologies and What They Mean To You: Part 3 - JSP
(Page 2 of 4 )

Definition

JSP is a Sun Micrososystems technology. You know Sun, the company behind Java? Good company, and JSP extends an already good technology. JSP is a free specification for extending Java Servlets to generate dynamic web pages on a web server.

Like most of our other technologies, JSP lets developers create dynamic HTML or XML pages that combine static page elements with dynamic content. This allows smart developers to separate the user bits like HTML from the logic bits, like the JSP code. JSP was created to simplify the Java Servlets technology, which we’ll cover in a future article, and to be simpler than the other offerings, like CGI, available at the time of its creation.

What It Really Is

So we understand that JSP is an extension of Java, for web pages, but what is it really about? For most people, that is Java’s biggest appeal; that they can tie into existing Java elements, and therefore save a lot of development time.

JSP is based on components. It uses JavaBeans and Enterprise JavaBeans (EJB) components which hold the business logic for an application, and it composes tags and a scripting platform for presenting the content generated and returned by the beans into HTML pages. The components structure means that non-Java developers can use JSP to manipulate beans that developers have built. On the other hand, Java developers can use these beans and Java in JSP pages for more advanced productions based on the beans.

A common JSP rollout would look something like this:

BROWSER <-> JSP PAGE <-> BEANS/ELEMENT <-> DATABASE


What is really happening in this process? A user calls a JSP page through their browser, so Resin (for instance), located on the web server, converts JavaScript, JSP tags, and HTML into segments of Java code, which the engine then consequentially arranges into a core Java servlet. This core servlet is therefore pre-assembled and works 'behind the scenes'. It is called every time that particular page is requested by a user, saving valuable recompiling time. The next time a user calls that page from their browser, because the JSP code has already been compiled, it does not have to convert the JavaScript, HTML, etc each time. That is, the servlet engine needs only to produce that servlet once, or after the last code change was updated.

JSP uses a combination of XML and CFM-like tags, as well as scripts written in Java, to generate page content. Applications written to the JSP specification can be run on compliant web servers, and web servers such as Apache, Netscape Enterprise Server, and Microsoft IIS that have had Java support added.

Advantages
  • Strong integration with JavaBeans and other elements
  • Ease of use for experienced Java developers
  • Rapid Application Development
  • Scales well to heavy loads
  • Cross-platform
  • Open Source
Disadvantages
  • JSP pages often run slower than similar pages such as PHP due to being more robust and intensive
  • Steeper learning curve than many other technologies
Examples

For many, many examples of JSP usage, as well as the full manual, go to http://java.sun.com/products/jsp/index.html.

Here are some standard types of things you might find...

Including a file:

<%@ include file="dukebanner.html" %>

Conditionally including a file:

<%
  if ( request.getParameter("username") != null )
  {
    include file="response.jsp"
  }
%>


Custom JSP tag:

<jsp:setProperty name="numguess" property="*" />

Similar Technologies

Really, any Net-based scripting language is “similar” to JSP in that it fulfills the same goals, and we will look at most of these during the rest of this article series:
  • ColdFusion: ColdFusion is Macromedia’s offering for web-based dynamic content. While it isn’t technically “scripting”, as it is based on an HTML-like tag structure, it does fulfill the same goal of providing dynamic webpages.
  • PHP: Like JSP, PHP is cross-platform. In some ways it is simpler to develop, because it doesn’t require separate files for logic and procedures, and in other ways it is harder to develop in (for basically the same reason). PHP is a very strong language with an incredibly large and supportive community.
Links

There are many sites out there dedicated to JSP. Many of the best ones are provided by the suppliers and backers (IBM, Sun, etc) but there are also lots of other great resources, and we’ve gathered some of the best ones here:

Tutorials

ServerPages.com Tutorials
http://www.serverpages.com/Java_Server_Pages/Tutorials/index.html

Building Your Own JSP Components
http://developer.iplanet.com/viewsource/fields_jspcomp/fields_jspcomp.html

Introduction to JSP
http://www6.software.ibm.com/reg/java/jsp-i

JSP By Example
http://java.sun.com/products/jsp/html/jspbasics.fm.html

Marty Hall’s Tutorials
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/

Resources

JavaServer Pages (Sun Microsystems)
http://java.sun.com/products/jsp/

Developer’s Guide
http://java.sun.com/products/jsp/docs.html

Tomcat
http://jakarta.apache.org/tomcat/


Resource Directory for Server Pages
http://www.serverpages.com/Java_Server_Pages/

JSP Resources
http://www.jsptags.com/

The JSP Resource Index
http://www.jspin.com/

JSP Insider
http://www.jspinsider.com/
Next: CGI >>

blog comments powered by Disqus
REVIEWS ARTICLES

- Music Streaming: ReverbNation.com
- Safari Books Online Review
- Super Styling with a Dedicated CSS Editor
- Book Review: Ground-Up Java by Philip Heller
- Book Review: Winning E-Brand Strategies: Dev...
- New Technologies and What They Mean To You: ...
- Review: Namo WebEditor 5

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 
Support 

Developer Shed Affiliates

 




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