Java
  Home arrow Java arrow Overview of Java Web Technologies, Par...
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    Overview of Java Web Technologies, Part 2
    (Page 1 of 10 )

    Today, Budi walks us through a refresher and brief overview of server JSP programming. Today's portion covers JavaServer Pages (JSP), with a thorough overview of JavaBeans and Tags. This excerpt comes from chapter one of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983-7, 2004).

    J2EE bookJavaServer Pages (JSP)

    Sun introduced servlets in 1996, and this technology soon became popular as a faster solution than the Common Gateway Interface (CGI) technology, which was the first technology for writing Web applications. However, Sun realized that writing servlets could be very cumbersome, especially if you need to send a long HTML page with little code. Take the following servlet as an example:

     
    import javax.servlet.*; 
    import javax
    .servlet.http.*; 
    import java
    .io.*; 
    import java
    .util.*; 
    public 
    class MyLongServlet extends HttpServlet 

    //Process the HTTP GET request 
    public void doGet(HttpServletRequest request, 
    HttpServletResponse response) 
    throws ServletException, IOException { 
    doPost(request, response); 


    //Process the HTTP POST request 
    public void doPost(HttpServletRequest request, 
    HttpServletResponse response) 
    throws ServletException, IOException { 
    response.setContentType("text/html"); 
    PrintWriter out = response.getWriter(); 
    out.println("<HTML>"); 
    out.println("<HEAD><TITLE>Using Servlets</TITLE></HEAD>"); 
    out.println("<BODY BGCOLOR=#123123>"); 

    //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.println("</BODY>"); 
    out.println("</HTML>"); 
    out.close(); 
    } //End of doPost method 
    } //End of class 



    Half of the content sent from the doPost method is static HTML. However, each HTML tag must be embedded in a String and sent using the println method of the PrintWriter object. It is a tedious chore. Worse still, every single change, even the change to a color code in an HTML tag, requires you to recompile the servlet.

    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

    - 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
    - Using RPC-Style Web Services with J2EE
    - Integrating XML with J2EE
    - Taming Tiger: Concurrent Collections
    - Combating the ‘Object Crisis’

    Iron Speed



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