Java
  Home arrow Java arrow Page 2 - Overview of Java Web Technologies, Par...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
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

Overview of Java Web Technologies, Part 2
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2004-03-03

    Table of Contents:
  • Overview of Java Web Technologies, Part 2
  • Sun's Solution
  • JSP and JavaBeans
  • Calling a Bean from a JSP Page
  • Accessing Bean Properties
  • Custom Tags
  • Developing and Using Custom Tag Libraries
  • Writing a Tag Handler
  • Writing and Using Tags
  • Model 2 Architecture

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Overview of Java Web Technologies, Part 2 - Sun's Solution


    (Page 2 of 10 )

    Sun’s solution to this problem is JSP. According to Sun’s Web site, “JSP technology is an extension of the servlet technology created to support authoring of HTML and XML pages.” Combining fixed or static template data with dynamic content is easier with JSP. JSP makes development more rapid than using servlets alone because it allows HTML tags to intersperse with Java code. No compilation is necessary. The first time a JSP page is invoked, the servlet/JSP container compiles it automatically. The MyLongServlet in the previous example can be rewritten in a JSP page like this:

     
    <%@ page import="java.util.Enumeration" %> 
    <HTML
    <HEAD><TITLE>Using JSP</TITLE></HEAD
    <BODY BGCOLOR=#DADADA> 
    <% 

    //Get parameter names 
    Enumeration parameters = request.getParameterNames(); 
    String param = null; 
    while (parameters.hasMoreElements()) { 
    param = (String) parameters.nextElement(); 
    out.println(param + ":" + request.getParameter(param) + 
    "<BR>"); 

    out.close(); 
    %> 
    </BODY> 
    </HTML> 

    However, note that JSP did not make servlets obsolete. In fact, JSP pages and servlets coexist in many JavaWeb applications. And, bear in mind that JSP is an extension of servlets.

    Inside the JSP container is a special servlet called the page compiler. The servlet container is configured to forward to this page compiler all HTTP requests with URLs that match the .jsp file extension. This page compiler turns a servlet container into a JSP container. When a JSP page is first called, the page compiler parses and compiles the JSP page into a servlet class. If the compilation is successful, the JSP servlet class is loaded into memory.

    On subsequent calls, the servlet class for that JSP page is already in memory; however, it could have been updated. Therefore, the page compiler servlet will always compare the timestamp of the JSP servlet with the JSP page. If the JSP page is more current, recompilation is necessary.With this process, once deployed, JSP pages go through the time-consuming compilation process only once.

    You may be thinking that after the deployment, the first user requests for a JSP page will experience unusually slow response, due to the time spent compiling the .jsp file into a JSP servlet. That scenario was anticipated, and to avoid this unpleasant situation, a mechanism in JSP allows the JSP pages to be precompiled before any user request for them is received. Alternatively, you can automatically load a JSP page by using the <load-on-startup> element under the <servlet> element in the deployment descriptor.

    Buy this book now!Remember: This is part two of the first chapter of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983). Stay tuned for more chapters of developer books from McGraw-Hill/Osborne.
    Buy this book!

    More Java Articles
    More By McGraw-Hill/Osborne


     

       

    JAVA ARTICLES

    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway