Section 14.1. Overview of JSP

   

14.1 Overview of JSP

JavaServer Pages do not exactly replace servlets. They offer a different direction in Java development on the server. JSPs were compared with ColdFusion in some detail in the last chapter, so we won't dwell on that now. JSPs offer a tag-based , XML-compatible way to create dynamic Web sites. They give you a flexible way to incorporate complete Java classes in the form of JavaBeans and custom actions.

ColdFusion consists of three basic elements: tags, functions, and components (CFCs). JSPs have four: tags (often called "actions"), scriptlets, directives, and beans. While JSP is in a sense a tag-based language, little of the functionality comes from the tags. In ColdFusion, much of what you do is in the tags already defined in the standard ColdFusion library. Historically, you might extend into writing a CFX tag if you needed some extra functionality that the tag library did not define.

Since ColdFusion 5 there has been a significant focus on helping developers write custom code. ColdFusion 5 saw the introduction of user -defined functions, and ColdFusion Components are now available in CFMX. JSP is far less concerned about providing an extensive , ready-made library to developers as it is with allowing maximum freedom. This can be both frustrating and rewarding : frustrating, because you have to write more code to get things done, and it can increase your development cycle time greatly (though we will see ways around this in the next chapter); rewarding, because you have a very open , extensible architecture to write exactly what you need in an object-oriented way.

14.1.1 JSP Syntax

A tricky thing for ColdFusion developers to pick up is how these different elements are represented. In ColdFusion, everything pretty much looks like this: <cftagname> ; ColdFusion tags, even the CFX tags, all start with "cf," which tells the processor to execute them differently than the HTML tags it also encounters.

JSP, on the other hand, has slightly different syntaxes to represent each of the different language elements referred to above. We'll now look at these in turn .


   
Top


Java for ColdFusion Developers
Java for ColdFusion Developers
ISBN: 0130461806
EAN: 2147483647
Year: 2005
Pages: 206
Authors: Eben Hewitt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net