Home arrow Java & J2EE arrow Overview of Java Web Technologies, Part 2

Overview of Java Web Technologies, Part 2

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).

  1. Overview of Java Web Technologies, Part 2
  2. Sun's Solution
  3. JSP and JavaBeans
  4. Calling a Bean from a JSP Page
  5. Accessing Bean Properties
  6. Custom Tags
  7. Developing and Using Custom Tag Libraries
  8. Writing a Tag Handler
  9. Writing and Using Tags
  10. Model 2 Architecture
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 9
March 03, 2004

print this article



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
import java
import java
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 { 
PrintWriter out = response.getWriter(); 
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) + 

} //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 & J2EE Articles          >>> More By McGraw-Hill/Osborne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates


Dev Shed Tutorial Topics: