Creating EL-Aware Taglibs Using XDoclet
When the JSP Tag Extensions (also known as taglibs) first came out, the only option to pass dynamic values as tag attributes was using Request Time (RT) expressions. With the advent of JSTL 1.0, another option ha
Tutorial Details:
This article assumes the reader already understand how EL works -- if you don't, a good introduction can be found in Sue Spielman's article, "Practical JSTL, Part 1."
The following code shows an example of RT and EL usage. First, we use RT to get the name of a user that is stored in the application context, given its login, passed as a parameter:
<%
String userName = "";
Map tmpMap = (Map) application.getAttribute( "usersMap" );
if ( tmpMap != null ) {
User tmpUser = (User) tmpMap.get( request.getParameter("login") );
if ( tmpUser != null && tmpUser.getName() != null ) {
userName = tmpUser.getName();
} // inner if
} // outer if
%>
Welcome <%= userName >!
Using EL and JSP 2.0, the same thing can be done much more concisely:
Welcome ${applicationScope.usersMap[param.login].name}!
As you can see in the example above, it is much easier for the page author to use EL rather than RT. But it is harder for taglib developers to implement custom tags that handle EL, as they have to explicitly write code in the tag handlers to evaluate the EL expressions at runtime.
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Creating EL-Aware Taglibs Using XDoclet
View Tutorial: Creating EL-Aware Taglibs Using XDoclet
Related
Tutorials:
Encapsulate reusable functionality in JSP
This tutorial shows you how you can encapsulate the resuable functionality in JSP pages. |
Rumble in the
jungle: J2EE versus .Net, Part
2
Rumble in the
jungle: J2EE versus .Net, Part
2 |
Call JavaBean methods from JSP
Call JavaBean methods from JSP 2.0 pages |
Excellent
tutorial on Struts and Tiles
Excellent tutorial on Struts and Tiles
This tutorial assumes knowledge of Java, JDBC, Servlets, J2EE (with regards to Web applications) and JSP Struts in a holistic manner, minus the beads and crystals.
The Tiles framework makes creating reusable pages |
Top 15 Ant Best Practices
Top 15 Ant Best Practices
Ant, building and deploying Java applications required a hodgepodge of platform-specific scripts, makefiles, proprietary IDEs, or manual processes. Now, nearly every open source Java project uses Ant. A great number of companie |
Practical Reflection: an excerpt from Hardcore Java
Practical Reflection: an excerpt from Hardcore Java
In this chapter from Hardcore Java, "Practical Reflection," Robert Simmons Jr. writes: "Reflection is one of the least understood aspects of Java, but also one of the most powerful. Reflection is used i |
Java Development on Eclipse, Part 1
Java Development on Eclipse, Part 1
Author\'s note: In part one of a two-part series of excerpts from Eclipse\'s Chapter 2, we\'ll get down to the business of developing Java using Eclipse. We\'re going to take a look at using Eclipse for Java developm |
Creating EL-Aware Taglibs Using XDoclet
Creating EL-Aware Taglibs Using XDoclet
When the JSP Tag Extensions (also known as taglibs) first came out, the only option to pass dynamic values as tag attributes was using Request Time (RT) expressions. With the advent of JSTL 1.0, another option ha |
Doclipse, a Javadoc tag plug-in for Eclipse
Doclipse
A JavaDoc Tag Plug-in for Eclipse |
Attribute-Oriented Programming with Java 1.5, Part 1
In this article, I will consider the case of a status-bar component embedded in a GUI application. I will explore a number of different ways to implement this status reporter, starting with the traditional hard-coded idiom. Along the way, I will introduce |
Introduction to Tag Unit
Getting Started
For the purpose of this article, let's say that we would like to test the core taglib from the Jakarta Taglibs implementation of the JSTL, a taglib that many people will be aware of and have experience with. Assuming that you already have |
Aspect-Oriented Annotations
Aspect-Oriented Annotations
Annotations are one of the new language features in J2SE 5.0, and allow you to attach metadata onto any Java construct. Meanwhile, Aspect-Oriented Programming (AOP) is a fairly new technology that makes it easier for you to en |
Annotations in Tiger, Part 1: Add metadata to Java code
Annotations, a new feature in J2SE 5.0 (Tiger), brings a much-needed metadata facility to the core Java language. In this first of a two-part series, author Brett McLaughlin explains why metadata is so useful, introduces you to annotations in the Java lan |
Reduce code bloat with XDoclet
Reduce code bloat with XDoclet
XDoclet can easily be one of the more versatile cross-technology code-generation tools in your Java programming toolbox. Unfortunately, developers often overlook XDoclet's general utility and use it only when it's bundled a |
Jakarta Taglibs
This project is an open-source repository for JSP custom tag libraries and associated projects, such as TagLibraryValidator classes and extensions to page-creation tools to support tag libraries. |
Encapsulate reusable functionality in JSP tags
JavaServer Pages (JSP) are a great mechanism for delivering dynamic Web-based content. JSP provides a set of predefined tags, but you can also define your own tag extensions that encapsulate common functionality. |
Struts and Tiles aid component-based development
In the Java world, Struts is one of the best-known and most talked about open source embodiments of MVC. |
Pool resources using Apache's Commons Pool Framework
Resource pooling is not new and is being widely used to conserve and optimize the usage of resources like threads, sockets, and database connections. Web server implementations routinely use thread pool implementations for performance and scalability reas |
Introduction to the JSP Java Server Pages
Introduction to the JSP Java Server Pages
Welcome to JSP Section
Introduction To JSP
Java Server Pages or JSP for short is Sun's solution for developing dynamic web sites. JSP provide excellent server side scripting support for creating database |
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 |
|
|
|