Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: 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

Tutorial Details:

The steps to getting TagUnit up and running are as follows.

First of all, you'll need to download a copy of the JSTL (I'm using v1.0.5) and TagUnit (I'm using v1.0.1).

Inside of the TagUnit distribution is a template web application called tagunit-blank.war. Because we're going to add to this webapp later, you'll need to deploy it to your JSP container in the exploded format. If you're using Tomcat, simply create a directory called tagunit-blank underneath $TOMCAT_HOME/webapps and extract the contents of the .war file into this directory.

At this point, if you would like to test the deployment, restart your server and point your browser to http://localhost:8080/tagunit-blank/. If all is well, you will see a page containing a number of test results for the TagUnit tags themselves.

The next step is to deploy your tag library into the tagunit-blank web application. With most tag libraries, this just involves copying one or more .jar files into WEB-INF/lib. With JSTL, you'll need to copy standard.jar and jstl.jar from the lib directory of the JSTL distribution into the WEB-INF/lib directory of the web application.

With the tags deployed, we now need to tell TagUnit about them. To do this, open up the /test/index.jsp file from the web application into your favorite text editor and modify the content to be the following.

<%@ taglib uri="http://www.tagunit.org/tagunit/core"
prefix="tagunit" %>




The first line imports the TagUnit tags, making them available for use, while the final three tell TagUnit that our tests will reside underneath /test/jstl-core and that we're testing the tag library deployed in [WEB-INF/lib/]standard.jar, described by the TLD file called c.tld inside of that .jar file.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Introduction to Tag Unit

View Tutorial:
Introduction to Tag Unit

Related Tutorials:

Test infect your Enterprise JavaBeans - JavaWorld May 2000
Test infect your Enterprise JavaBeans - JavaWorld May 2000
 
WAP for Java developers - JavaWorld June 2000
WAP for Java developers - JavaWorld June 2000
 
Warning! Threading in a multiprocessor world - JavaWorld February 2001
Warning! Threading in a multiprocessor world - JavaWorld February 2001
 
Boost Struts with
Boost Struts with XSLT and XML
 
Rumble in the jungle: J2EE versus .Net, Part 2
Rumble in the jungle: J2EE versus .Net, Part 2
 
JSP Standard Tag Library eases Webpage development
JSP Standard Tag Library eases Webpage development
 
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
 
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
 
Tag Library Documentation Generator 1.2
Tag Library Documentation Generator is a utility for automatically generating javadoc-style documentation for JavaServer PagesTM (JSPTM) Technology Tag Libraries.
 
BEA WebLogic Portal JSP Tag Libraries
The BEA WebLogic Portal includes four JSP tag libraries that are used by the portal's JSP pages.
 
JAVASERVER PAGESTM JAVASERVER PAGESTM
JSPTM tag libraries define declarative, modular functionality that can be reused by any JSP page. Tag libraries reduce the necessity to embed large amounts of Java code in JSP pages by moving the functionality provided by the tags into tag implementation
 
JSP Tags
JSP tags do not use <%, but just the < character. A JSP tag is somewhat like an HTML tag. JSP tags can have a "start tag", a "tag body" and an "end tag". The start and end tag both use the tag name, enclosed in < and > characters. The end starts with
 
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.
 
J2EE pathfinder: Implement JSP custom tags in five easy steps
JSP custom tags provide a standardized mechanism for separating presentation and business logic in a dynamic Web page, allowing page designers to focus on presentation while application developers code the back end. In this installment of J2EE pathfinder,
 
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
 
Advanced Features of JSP Custom Tag Libraries
In this article, the second in the JSP custom tag libraries series, we will cover advanced JSP features and how to use them.
 
Practically Groovy: JDBC programming with Groovy
Take your practical knowledge of Groovy one step further this month, as Andrew Glover shows you how to use GroovySql to build a simple data-reporting application. GroovySql combines closures and iterators to ease Java Database Connectivity (JDBC) programm
 
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
 
Introduction to JSP tags JSP Directives
Introduction to JSP tags JSP Directives INTRODUCTION TO JSP TAGS I n this lesson we will learn about the various tags available in JSP with suitable examples. In JSP tags can be devided into 4 different types. These are: Directives In the
 
Site navigation
 

 

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

Copyright © 2006. All rights reserved.