JSTL SPECIFICATION PDF

Implementors of JSTL and authors of JSP pages may find the The JavaServer Pages™ Standard Tag Library (JSTL) specification is the result. The JavaServer Pages Standard Tag Library (JSTL) is a component of the Java EE Web application development platform. It extends the JSP specification by. Apache hosts the Apache Standard Taglib, an implementation of the JSP Standard Tag Library (JSTL) specification. Various versions are.

Author: Fegrel Malajas
Country: Kenya
Language: English (Spanish)
Genre: Business
Published (Last): 12 February 2009
Pages: 243
PDF File Size: 10.16 Mb
ePub File Size: 13.80 Mb
ISBN: 937-1-45996-211-1
Downloads: 62328
Price: Free* [*Free Regsitration Required]
Uploader: Yogore

Have you heard about the JSTL but aren’t quite sure of how to make the best use of it? The book has just been released and comes with free download of all code examples used throughout.

JavaServer Pages Standard Tag Library – Wikipedia

Each standard action is covered with a detailed explanation and includes sjtl code sample so you can start using the JSTL immediately. The following sections are excerpted from various chapters within the Jst Practical Guide for Java Programmers. The specification can be found at http: These tag libraries provide a wide range of custom action functionality that most JSP authors have found themselves in need of in the past.

Having a defined specification for how the functionality is implemented means that a page author can learn these custom actions once and then use and reuse them on all future products on all application containers that support the specification.

Using the JSTL will not only make your JSPs more readable and maintainable, but will allow you to concentrate on good design and implementation speicfication in your pages. No more creating your own iteration action for the tenth time. This kstl of common functionality has come about through the input of the various members of the expert group. Since this expert group has a good cross section of JSP authors and users, the actions provided in the JSTL should suit a wide audience.

While the JSTL is commonly referred to as a single tag library, it is actually composed of four separate tag libraries:. These libraries are defined by the Tag Library Descriptor files. Using separate TLDs to expose the tags, the functionality for each set of actions is apparent and makes more.

Using separate TLDs also allows each library to have its own namespace. To sum up for now, the layout of the JSTL is straightforward. The overriding theme throughout the JSTL is simplifying the life of the page author.

The page author is the person who builds the JSP pages. There has always been a need although not a requirement that the page authors have some understanding of a programming language usually Java in order to create complex pages.

This dilemma is what has hampered the true role separation between the JSP page author and the Java programmer. Sspecification the tags provided in the JSTL, we soecification closer to reaching that clean division of labor. The functional speecification in the JSTL help page authors identify what type of functionality they specificatkon and where they can find it. Before we dive into the various functional areas in the JSTL, we should start with the expression language. As touched on briefly in the first chapter, this is one of the most important features of the JSTL and is a prominent feature of the JSP 2.

Expressions in template text are not supported if you are using JSTL 1. What it means to use EL in attributes can be shown in the following example:.

If the book is not specfication stock, we can access the book Object by using the EL and assigning that to the value attribute. Anyone who has worked with JSPs before can certainly appreciate the ease-of-use and coding simplification possible with the EL.

  M6800 MICROPROCESSOR PROGRAMMING MANUAL PDF

If you are working with JSP 2. Keep in mind that when using an identifier like book ,for example with the EL, it is the same thing as if you had done PageContext. The identifier xpecification can reside in any of the known JSP scopes. This includes pagerequestsession ,or application scope. If the identifier isn’t found in any scope, then a null value is returned.

There are quite a few implicit objects exposed through the EL. These objects allow for access to any variables that are held in the particular JSP scopes. Objects include pageScope, requestScope, sessionScope, and applicationScope.

Again, this is as if you had made ServletRequest. The initParam gives access speclfication context initialization parameters, while cookie exposes cookies received in the request. The EL operations are jst, to handle data manipulations.

All of the standard and common operators are available. Functionality is included in the EL for relational, arithmetic, and logical operators.

The automatic type conversion is a very convenient feature of the EL in that a full set of coercion between various object and primitive types is supported. Coercion means that the page author isn’t responsible for converting parameters into the appropriate objects or primitives. The JSTL defines appropriate conversions and default values. For example, a String parameter from a request will be coerced to the appropriate object or primitive.

If we are dealing with Awhich is an item or object, the coercion rules supplied by the JSTL will be applied for each given type. These coercions are done under the covers for you by the implementation, but it is always a good idea to understand how, and in what order, the rules are being applied. Let’s look at Example 3. If a parameter that represents the month is passed in the request as a Stringthe value of the month variable will be correct because the String will be coerced to the correct type when used.

If the value of the parameter does not parse correctly to a number say, the value is September instead of 9 at jtsl point an exception will be thrown. Having automatic type conversions can save unnecessary exceptions from happening. An exception occured trying to convert String “September”to type “java. The page author can handle an unexpected value more in a user-friendly way, perhaps informing the user of the type of data that is expected or providing a sample of the format of data required by the user.

A more graceful handling of an error is shown in Example 3. Perform a multiplication operation to show that the type is correct: The set of tags that are available in the Core tag library come into play for probably most anything you will be doing in your JSPs. Let’s walk through code samples to see how we use each of the tags provided in this specificatoin.

  ENTRE LAS SABANAS IAN MCEWAN PDF

Let’s look at each functional section in the Core tag library a bit more closely. There are four general-purpose tags. It is used to output to the current JspWriter. The value to be written to the JspWriter is specified as a value attribute.

You can specificatipn expressions in the value attribute. This allows for the resulting evaluation to be sent to the JspWriter. The XML entity values that are used for encoding the characters are shown in Table 4.

This capability is controlled by the escapeXml attribute. It defaults to true. In another example, we might want to output some data values that have been stored in a scoped variable called myData. There are HTML tags included in the string that we want to make sure are rendered correctly with the string bolded.

To ensure that the data is displayed to the user correctly we would use:. With escapeXml set to false, our users see the correct display with the text bolded. Jjstl two displays are shown as they would appear if you were to view the source of the resulting file in your browser.

The first output is using the default value of escapeXmlwhile the second output shows the result of using the esacpeXml set to false. With escapeXml defaulting to true:. With escapeXml set to false:. More than likely, the application you are developing today will have to be internationalized tomorrow. Wouldn’t it be great if the effort required to internationalize your application could be reduced to zero?

Well okay, that might be too optimistic to hope for since anyone who has developed applications for international use knows there is always something that needs to be tweaked. Luckily, the internationalization and formatting actions provided in the JSTL are a comprehensive set of actions that can be used to minimize the headaches of having to internationalize your application. These actions come under the functionality of the I18N umbrella.

I18N, which refers to the 18 letters between the I and the N in internationalization ,is a common acronym used when talking about internationalization features. It is also common to use the term L10N, for localization. In this chapter, we’ll explore these internationalization actions. Formatting for numbers, dates, and currency, which includes such actions as:.

To address both of these functional areas, let’s first take a cursory look at what pieces are involved in creating international applications. Then we’ll look at how these pieces can be put to work using the various actions available in the JSTL.

The appropriate resource bundle will be used to jztl up the key “welcome” and the translated string will be provided. This is about as easy as it gets to incorporate international support into your application. For example, you can provide variables that will be used within the string used by the key attribute. Say we want to personalize our welcome page and pass the name of a user so that we can welcome them. We will talk about this in more detail later in this chapter, but as a quick example, so that you are familiar with the format, the action might look like:.

In this example, we would be accessing a variable already set, called userNameStringthat would then be used as a parameter to the message. If we were accessing the English version of the resource bundle,Welcome Sue would appear in the JspWriter.

Author: admin