Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

JSP Technology -- Friend or Foe?

By Brett McLaughlin
2003-03-07


Segregation vs. integration

The primary purpose of presentation technology is to allow a separation between content and presentation. In other words, business logic units (presumably in some programming language like C or Java) don't have to generate data in a presentation-specific manner. Data, or content, is returned raw, without formatting. The presentation technology then applies formatting, or presentation, to this content. The result is an amalgam of data surrounded by and intertwined with graphics, formatting, colors, and logos.

Look at the examples in Listing 1 and Listing 2 to see at a glance the difference between raw content and content combined with presentation technology.

Listing 1 shows raw content, with nothing but data, that could be used in a variety of ways.

Russell Crowe

Tom Hanks
Meg Ryan
Mary Stuart Masterson
Alec Baldwin
Ashley Judd
Keanu Reeves

Listing 2, which is much more complex than the one above, shows the same data wrapped in presentation technology and ready for display in an HTML-capable browser.



<HTML>
<HEAD>
<TITLE>Search Results: Actors</TITLE>
</HEAD>
<BODY>
<H2 ALIGN="center">Search Results: Actors</H2>
<CENTER>
<HR width="85%">
<TABLE width="50%" CELLPADDING="3" CELLSPACING="3" border="1"
BGCOLOR="#FFFFCC">
<TR BGCOLOR="#FFCCCC">
<TH width="50%" ALIGN="center">Last Name</TH>
<TH width="50%" ALIGN="center">First Name</TH>
</TR>
<TR>
<TD width="50%">Baldwin</TD>
<TD width="50%">Alec</TD>
</TR>
<TR>
<TD width="50%">Crowe</TD>
<TD width="50%">Russell</TD>
</TR>
<TR>
<TD width="50%">Hanks</TD>
<TD width="50%">Tom</TD>
</TR>
<TR>
<TD width="50%">Judd</TD>
<TD width="50%">Ashley</TD>
</TR>
<TR>
<TD width="50%">Masterson</TD>
<TD width="50%">Mary Stuart</TD>
</TR>
<TR>
<TD width="50%">Reeves</TD>
<TD width="50%">Keanu</TD>
</TR>
<TR>
<TD width="50%">Ryan</TD>
<TD width="50%">Meg</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>

While the content in Listing 1 is clear and easy for the uninitiated layperson to both use and understand, the content in Listing 2 is very specific to the task of display in a browser. It is tricky to extract data from it or manipulate it for any other purpose.

This fundamental difference, the process of segregating content from presentation instead of integrating the two (at least until the user needs the information), is the basic premise of any presentation technology, including the JSP technology. Further, any presentation technology that does not accomplish this basic goal does not truly accomplish the goal it was created to achieve.



Tutorial Pages:
» A critical look at JavaServer Pages servlets as a viable presentation technology
» A bit of history
» The premise
» Segregation vs. integration
» Work vs. rework
» The promise of JSP technology
» Content vs. presentation
» Code vs. markup
» Designer vs. developer
» The problems
» Portability vs. language lock-in
» Mingling vs. independence
» Blurring the line between content and presentation
» Single-processing vs. multi-tasking
» HTML vs. XML
» Summary
» Resources


First published by IBM developerWorks


 | Bookmark
Related Tutorials:
» All about JAXP, Part 1
» Make Database Queries Without the Database
» Load List Values for Improved Efficiency
» 2 Ways To Implement Session Tracking
» A Simple Way to Read an XML File in Java
» Develop Aspect-Oriented Java Applications with Eclipse and AJDT

Ask A Question
characters left.