Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: JSP 2.0: The New Deal, Part 3

JSP 2.0: The New Deal, Part 3 More Flexible JSP Document Format Rules The JSP specification supports two types of JSP pages: regular JSP pages containing any type of text or markup, and JSP Documents, which are well-formed XML documents; i.e., docum

Tutorial Details:

Tag libraries are declared as XML namespaces in a JSP Document. For instance, a JSP Document with XHTML template text and JSP actions from the standard and the JSTL core libraries should have an root element with these namespace declarations:

xmlns=\"http://www.w3c.org/1999/xhtml\"
xmlns:jsp=\"http://java.sun.com/JSP/Page\"
xmlns:c=\"http://java.sun.com/jsp/jstl/core\"
xml:lang=\"en\" lang=\"en\">

The xmlns attribute sets the default namespace to the XHTML namespace, the xmlns:jsp attribute associates the jsp prefix with elements defined as JSP standard actions, and the xmlns:c attribute associates the c prefix with the elements defined by the JSTL core library.

JSP Documents have been part of the JSP specification from day one, but initially as an optional feature and later with many limitations. JSP 2.0 lifts most of these limitations, making it much easier to work with the combination of XML and JSP.

Prior to JSP 2.0, a JSP Document had to have a root element, to tell the container what type of JSP page it was. JSP 2.0 removes this limitation by defining new ways to identify a file as a JSP Document. A file is processed as a JSP Document by a JSP 2.0 container if one of these conditions is true:

1.

The request path matches the URL pattern for a web.xml JSP property group declaration with an element set to true. See part two of this series for more on JSP property group declarations.
2.

The request path extension is .jspx, unless this extension matches the URL pattern for a JSP property group declaration with an element set to false. In other words, .jspx is the default extension for JSP Documents, but it can be explicitly disabled by a property group declaration.
3.

The request path extension is either .jsp or matches a URL pattern for a JSP property group declaration and the root element in the file is .

These new rules make it possible to write a JSP Document as a regular XHTML file (with JSP elements for the dynamic content, of course), for instance, without having to place all content within a element. You can even use .html as the extension for such files if you create a JSP property group declaration like this:

...


*.html
true


...



 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
JSP 2.0: The New Deal, Part 3

View Tutorial:
JSP 2.0: The New Deal, Part 3

Related Tutorials:

Understanding JavaServer Pages Model 2 architecture - JavaWorld December 1999
Understanding JavaServer Pages Model 2 architecture - JavaWorld December 1999
 
Advanced form processing using JSP
This article examines the processing of a user registration form using JSP and JavaBeans while implementing the Memento design pattern.
 
Process JSPs effectively with JavaBeans
This articles shows your how you can process JSPs effectively with JavaBeans
 
An open alternative to JSP - The faults of JSP So what's wrong with JSP?
How the template-based, open source API FreeMarker trumps JSP
 
Jato: The new kid on the open source block, Part 3 - JavaWorld May 2001
Jato: The new kid on the open source block, Part 3 - JavaWorld May 2001
 
Superior app management with JMX - JavaWorld June
Integrate JMX, a reusable configuration framework, with your JSPs
 
Device programming with MIDP, Part 3 - JavaWorld July 2001
Device programming with MIDP, Part 3 - JavaWorld July 2001
 
JSP best practices
Follow these tips for reusable and easily maintainable JavaServer Pages
 
Boost Struts with
Boost Struts with XSLT and XML
 
A first look at JavaServer Faces, Part 2
A first look at JavaServer Faces, Part 2
 
Customize SwingWorker to improve Swing GUIs
Customize SwingWorker to improve Swing GUIs
 
Introduction to JavaServer Faces
This article is meant to acquaint the reader with JavaServer Faces, commonly known as JSF. JSF technology simplifies building the user interface for web applications. It does this by providing a higher-level framework for working with your web app, repres
 
JSP 2.0: The New Deal, Part 3
JSP 2.0: The New Deal, Part 3 More Flexible JSP Document Format Rules The JSP specification supports two types of JSP pages: regular JSP pages containing any type of text or markup, and JSP Documents, which are well-formed XML documents; i.e., docum
 
JSP 2.0: The New Deal, Part 4
JSP 2.0: The New Deal, Part 4 In this final part of the "JSP 2.0: The New Deal" series, we look at two new features that make it much easier to develop custom tag libraries: tag files and the new simplified tag-handler Java API.
 
JSP (JavaServer Pages) is a standard for combining Java and HTML to provide dynamic content in web pages.
With JSP, you embed Java code in HTML using special JSP tags similar to HTML tags. You install the JSP page, which has a .jsp extension, into the WebLogic Server document root, just as you would a static HTML page. When WebLogic Server serves a JSP page..
 
JSPTags.com offers JSP developers a directory of resources.
JSPTags.com offers JSP developers a directory of resources related to JavaServer Pages, Servlets and Java. As the name JSPTags.com implies, special interest is given to JSP Tag Libraries. Many developers are working with and designing new JSP Tag Librarie
 
This tutorial shows how to Creating Custom JSP Tag Libraries
JSP 1.1 introduced an extremely valuable new capability: the ability to define you own JSP tags. You Define how the tag, its attributes, and its body are interpreted, then group your tags into collections called tag libraries that can be used in any numbe
 
Reuse Tiles and Simplify UI
JavaServer Pages (JSP) technology supports application object reuse through includes, which allow other files (including other JSPs) to be sourced into a JSP file either at compile time or dynamically at application runtime. This is great for abstracting
 

JSP Hosting
 
Using Taglib in JSP. A brief introduction to taglibs and taglibs programing.
Using Taglib in JSP. A brief introduction to taglibs and taglibs programing. JSP TAG LIBRARIES JSP Tag Libraries : JSP’s offer a unique feature of “Tag Libraries”. Simply put, these are custom defined JSP tags. They are basically meant for
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.