Java
  Home arrow Java arrow Page 2 - Overview of Java Web Technologies, Part 2
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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: starstarstarstarstar / 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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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

    - Exception Handling Techniques in Java
    - More About Multithreading in Java
    - The Basics of Multiple Threads in Java
    - Data Access Using Spring Framework JDBC
    - New Object Initialization in Java
    - 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...





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