The Custom Tag Library Extension For UltraDev

About the Extension

Purpose - The Custom Tag Library Extension for Dreamweaver UltraDev (CTLX) provides functionality for creating Java Server Pages with Custom Tag Libraries in the UltraDev design environment.

Usage - The extension is interfaced through two floating palettes. The user selects a custom tag library from a list of those available, and is able to insert, edit and remove any custom tag in the library. Through UltraDev's Live Data Mode, the user is presented with an interactive HTML representation of the JSP, mimicking the presentation of the JSP in a browser.

How it Works - The extension's functionality is implemented in 2 parts: the TLDParser servlet and the UltraDev extension files. The TLDParser contains a tlds directory, into which the user places the TLD files of any custom tag library to be used by the extension. When the user selects a custom tag library in the UltraDev floating palettes., the extension requests a description of the tag library from the servlet. The servlet responds with a description of the tag library as a series of JavaScript associative array declarations, which are evaluated by the extension. If not already present, the response is stored into a local cache to increase performance. The cache may be purged at any time to reduce the extension's memory footprint. 1 MB of memory can cache roughly 200 - 1000 custom tag libraries.

What's Included - The extension contains the following items:

  • TLDParser.war - The servlet for parsing TLD files
  • ultradev4-tutorial.war - The web application for the included tutorial
  • ctlx.mxp - The packaged extension files for UltraDev
  • index.html - This documentation

Limitations - The Custom Tag Library extension is not commercial software intended to be used immediately for creating web applications. Rather it is part of an ongoing investigation into the current and potential level of authoring tool support for the creation of JSPs with custom tag libraries. The extension is intended to serve as a foundation for this investigation, to expose the current level of support and to be built upon. The current extension functions inside a version of UltraDev that has not been designed to provide support for custom tag libraries. As such, there are limitations on the extension's ability to provide the level of interaction necessary to make working with more powerful tag libraries truly interactive and intuitive. These limitations may be addressed by discussions with tool vendors on increased JSP support in their products. The relevant known caveats are discussed in Things to Watch.

Installation Guide

A note about performance: Since the CTLX requires that UltraDev and Tomcat run concurrently, at least 96 MB of memory is recommended for reasonable performance. At least a Pentium II (PC) or G3 (Mac) processor is also recommended.

In order to install the Custom Tag Library extension for UltraDev, follow the following installation instructions. You will need to acquire and install several other software packages, as follows:

  • Download and Install Dreamweaver UltraDev 4 - It is STRONGLY recommended that you use UltraDev version 4 or or later. The extension is designed to make use of UltraDev SDK API enhancements incorporated into UltraDev 4 (see "Usage of UltraDev Version 1" under Things to Watch for a note on this). A fully functional 30 day trial version of UltraDev 4 is available at: http://www.macromedia.com/software/ultradev/trial.
  • Download Java Development Kit - You must download and install a Java2 (version 1.2 or later) Java Development Kit implementation for your operating system platform. A good starting point for locating Java Development Kit distributions is http://java.sun.com/j2se.
  • Download and Install Tomcat - You must download and install a servlet container that is compatible with the Servlet API Specification, version 2.2 or later, and the Java Server Page (JSP) Specification, version 1.1 or later. Recommended is Apache's Tomcat (version 3.1 or later required, version 3.2 or later recommended). Download the zip or tar.gz file and unzip the file into some directory, say "foo". This should create a new subdirectory named "jakarta-tomcat" in foo. Set a new environment variable to point to the root directory of your Tomcat hierarchy:
    • On Win32, you should type:
      "set TOMCAT_HOME=foo\jakarta-tomcat" or set the variable persistently through the System control panel.
    • On UNIX you should type:
      • for bash/sh "TOMCAT_HOME=foo/jakarta-tomcat ; export TOMCAT_HOME"
      • for tcsh "setenv TOMCAT_HOME foo/tomcat"
    • Set the environment variable JAVA_HOME to point to the root directory of your JDK hierarchy.
  • Install the WAR Files Into Tomcat - Copy the ultradev4-tutorial.war and TLDParser.war files to the TOMCAT_HOME/webapps/ directory.
  • Install the UltraDev extension files - Double click on the file "ctlx.mxp" to install the UltraDev extension files. The installation will add the following files to the UltraDev/Configuration/ directory:
    • Commands/customTags/tagEdit.js
    • Commands/customTags/tagLibData.js
    • Commands/customTags/tagLibInsert.js
    • Commands/customTags/useTagLibs.js
    • Commands/Floaters/tagEdit.html
    • Commands/Floaters/useTagLibs.html
    • Modifies the Menus/menus.xml file to add commands to open the floating palettes for interfacing with the extension files.
    The extension may be removed and the menus.xml file reverted to its original state at any time by removing the extension through the Extension Manager.
Using the Extension

This section explains how to get started with the extension and describes its functionality. Note: For a detailed example using the extension, see the tutorial below.

Before launching launching UltraDev, be sure to do the following:

  • Place a copy of the TLD file of any custom tag library you with to use into the TLDParser/tlds directory.
  • Start Tomcat on port 8080 (see "Configuring CTLX for Tomcat" under Things to Watch for information on changing the location and port where the extension looks for Tomcat).

Launch UltraDev. Once it is launched the first thing you need to do is create a JSP site to contain your files. In addition to the local copy, the site must exist in the TOMCAT_HOME/webapps/ directory. See the Tutorial below for a detailed walk through of creating a site.

Note: The extension will function most effectively if it is used to create a JSP from scratch. See "Usage on Pre-existing JSPs" under Things to Watch.

In order to use the extension, Live Data Mode must be enabled. Outside of Live Data Mode you may experience unexpected results. To enable Live Data Mode, hit ctrl+shft+R or select View | Live Data Mode. The first time you use Live Data Mode you will experience an extended lag between screen refreshes. This is because UltraDev is pinging Tomcat to translate the JSP into HTML every time you make a change to dynamic content. After the initial translation, the lag will decrease substantially as the software reuses previously compiled code.

The extension's floating palettes are accessed under the Window menu. The "Use Custom Tags" floater is used for setting the current tag library in use and inserting its tags into the page, and purging the local cache (see "How it Works" under About the Extension for a note on CTLX's local caching scheme). The "Edit Custom Tags" floater is used to make changes to the attributes of custom tags in the JSP, and remove custom tags if desired. Their use is as follows:

  • Use a Custom Tag Library
    • Select a Custom Tag Library - A drop-down menu that is populated at startup with a list of the tlds in the TLDParser/tlds directory.
    • Use Tag Library - Requests a description of the selected tag library from the TLDParser. Stores response in local cache if not already present. Populates the "Select Tag to Insert" drop-down menu with the selected tag library's tags.
    • Purge Local Cache - Removes all tag libraries from the local cache to decrease memory footprint. Depopulates the "Select Tag to Insert" drop-down menu.
    • Select Tag to Insert - A drop-down menu that is populated with the tags of the currently selected tag library when "Use Tag Library" is clicked.
    • Insert - Inserts the selected custom tag into the JSP at the current selection point in the document. The exact placement of the insertion depends on whether the tag has body content, whether the selection is surrounding HTML or just an insertion point, and more. See "Insertion" under Things to Watch below for a detailed explanation.
  • Edit Custom Tags
    • The Attribute/Value Control Grid - Populated every time the user changes the selection in the active JSP. If the selection is a custom tag (see "Selection" under Things to Watch for details on selecting custom tags), the grid is populated with the tag's attribute value pairs. If an attribute has no value, the attribute is displayed but the value is left empty. The user may type directly into the control grid to change the values of attributes, but must hit "Apply" for them to take effect.
    • Apply - Replaces the attribute/value pairs of the custom tag selected in the JSP with the attribute/value pairs entered in the control grid.
    • Reset - Restores the control grid's attribute/value pairs to their state when the user last clicked Apply.
    • Remove Tag - Removes the currently selected custom tag from the JSP
Tutorial

This section takes the reader through a detailed tutorial that constructs a JSP with custom tag libraries to demonstrate the features (and idiosyncrasies) of the extension. Before starting the tutorial, be sure you have followed the installation guidelines thoroughly. The tutorial will construct a mock message reading application using some of the custom tags from the Struts framework. For more information on Struts visit http://jakarta.apache.org/struts/index.html.

Before using the extension, you must first place the TLD files of any custom tag libraries you wish to use into the TLDParser/tlds directory. For this tutorial, you'll need the 3 tlds included in the ultradev4-tutorial.war file.

  • If you have not started Tomcat since placing the ultradev4-tutorial.war file into the TOMCAT_HOME/webapps directory, do so now to expand the archive.
  • Copy the struts.tld, struts-bean.tld and struts-logic.tld files from TOMCAT_HOME/webapps/ultradev4-tutorial/WEB-INF/ to
    TOMCAT_HOME/webapps/TLDParser/tlds

The tag libraries are now accessible to the extension. If Tomcat is not running, start Tomcat on port 8080 (see "Configuring CTLX for Tomcat" under Things to Watch for information on changing the location and port where the extension looks for Tomcat), and launch UltraDev. Once UltraDev is running, the first step is to create a site for the tutorial.

  • Select Site|Define Sites... and click the New... button
  • Under the Local Info category, make only the following changes:
    • Set Site Name to ultradev4-tutorial
    • Set the Local Root Folder by clicking on the adjacent folder icon and browsing to the root directory of UltraDev. Create a new folder called ultradev4-tutorial, open the folder, and select it.
  • Under the Remote Info category, make only the following changes:
    • Set Access to Local/Network
    • Set the Remote Folder by clicking the adjacent folder icon and browsing to TOMCAT_HOME/webapps/ultradev4-tutorial/, and opening and selecting it.
  • Under the Application Server category, make only the following changes:
    • Set Server Model to JSP 1.0
    • Set Remote Folder by clicking the adjacent folder icon and browsing to TOMCAT_HOME/webapps/ultradev4-tutorial/, and opening and selecting it.
    • Set URL Prefix to http://localhost:8080/ultradev4-tutorial/
  • Hit OK, and hit Done in the Define Sites window. Allow UltraDev to create a cache of the site for improved performance.
  • In the Site window, click on the green down arrow to get the entire site. When asked if you are sure you want to get the entire site, click OK.

With the Site window open, double click on the ctl-message.jsp file in the Local Folder pane to open it. Now hit ctrl-shft-R (or select View|Live Data Mode) to enter Live Data Mode. You must be in Live Data Mode to use the extension. If switching to Live Data Mode raises an UltraDev error, make sure you entered in all the site information properly. If the animated gears on the upper-right corner of the document window stop moving without raising an error, you have successfully entered Live Data Mode. See "Perfomance in Live Data Mode" under Things To Watch for a note about the speed of screen refreshes in Live Data Mode.

In order to see what the extension is doing to the HTML source as you change the document, select View|Code and Design to split the window so you can see the HTML source while you make changes to the document window. You may notice that the JSP is empty except for a scriptlet at the top of the <body> tag that initializes an ArrayList into the JSP's PageContext. The ArrayList will be used in the tutorial, but note that scriptlets are not necessary for successful use of the extension or the included tag libraries. The data in the included scriptlet could just as effectively been placed into a bean and instantiated with a <jsp:usebean> call. The scriptlet is used in this tutorial to reduce the mystery surrounding what the tag is doing.

Now you are ready to build the JSP. Start by clicking in the blank document window and entering the text "Messages for ". Next, click the Insert Table button in the objects palette and insert a table with 1 row and 2 columns. Once inserted, click inside the left cell and type "message". Hit tab to enter the right cell, and type "read". These elements will serve as the skeleton for our dynamic content, which you will now add.

Open the extension's "Use a Custom Tag Library" floater by selecting Window|Use Custom Tags. See Using the Extension for a summary of the role and functionality of this floater.

  • Click on the "Select a Custom Tag Library" drop-down menu. It should be populated with the 3 tlds that you copied to the TLDParser/tlds directory: struts-bean, struts-logic and struts. Select "struts" and hit Use Tag Library. The extension will ask you for the location of the TLD file. The default is correct, so hit OK. You are then asked for a prefix. Any alphanumeric prefix may be used, and the default (which is taken from the name of the TLD file) is fine, so hit OK. The namespace instantiation for the struts tag library is added to the top of the HTML source, and the "Select Tag to Insert" drop-down menu is populated with the struts custom tags.
  • Put the current insertion point after the space following the
    "Messages for " text in the document window. Select "parameter" from the "Select Tag to Insert" drop-down menu and click insert. The extension asks you enter values for all required attributes so the server can compile the page successfully. For this tag, you are asked for a value for the "name" attribute. The parameter tag uses its name attribute to display the value of the http request parameter called "name". Enter "user" and hit OK. The extension inserts the tag into the HTML source and refreshes the document window.
  • Note the document window does not change, because the server has been sent no "user" parameter. UltraDev provides a way to tack request parameters onto an http request. Select View|Live Data Settings. Click the plus (+) button in the URL Request grid and add the "user" parameter. For the value, enter your name. Hit OK. The document window refreshes and your name appears following the "Messages for " text.

Take note that even though your name is really a tag, you can treat it much like a standard HTML element. Click on your name and hit ctrl-i. Your name becomes italicized, as if it were standard text. You can push it around by inserting text before it, and you could even drag it around to a new location (if you do drag it somewhere else, you will need to hit ctrl-r to refresh the display, but save that experimentation until the tutorial is completed).

Your document window should now look something like this:

Messages for [your name]
message read

The next step is to provide functionality for the table to display every message for the user. You will treat the provided ArrayList as a list of messages (imaging they were procured from a server with another custom tag), and iterate over them with the struts "iterate" tag, creating a new row in the table for each message in the ArrayList.

  • The iterate tag is in the struts-logic tag library. Select struts-logic from the "Select a Custom Tag Library" drop-down menu and hit Use Tag Library. Again, the default TLD location is correct. The prefix has been changed from "struts-logic" to "strutslogic" since prefixes must be alphanumeric. The default is fine, but you may make it whatever you wish. The namespace instantiation is added to the top of the page, and the "Select Tag to Insert" drop-down menu is populated with the struts-logic tags.
  • Click inside the left table cell, and click the <tr> tag from the tag ancestor list at the bottom left corner of the document window. The contents of the <tr> tag in the source window should now be selected.
  • Select "iterate" from the "Select Tag to Insert" drop-down menu. Enter "item" for the id value.
  • The iterate tag is wrapped around the <tr> tag, and the document window refreshes.

**THIS GENERATES A LIVE DATA ERROR** Hit OK. The source of the error is a complication in the tld file for the struts-logic tag library. The entry for "iterate" in the tld file only contains one required attribute: "id". For the tag to compile, however, one of either "collection" or "name" must also be specified. Since the tag uses one of "name" or "collection" but not both, the TLD cannot specify that both are required, so it specifies that neither is required. The extension only asks for required attributes on insertion, so the JSP gets sent to the server without a value for either "name" or "collection", generating an internal servlet error. We can add the necessary value by editing the tag.

  • Open the "Edit Tag" floater by selecting Window|Edit Custom Tags. See Using the Extension for a summary of the role and functionality of this floater.
  • Click inside the left table cell again. Now click the <strutslogic:iterate> tag in the tag ancestor list at the bottom left corner of the document window. The "Edit Tag" floater populates with the current attribute/value pairs of the iterate tag (see "Selection" under Things to Watch for details on selecting custom tags).
  • Enter "list" as the value for the "name" attribute, and hit Apply. This change causes the tag to iterate over the ArrayList earlier defined as "list". The single table row becomes 5 rows, one for each element in the ArrayList.
  • Click inside the left table cell and click <strutslogic:iterate> in the tag ancestor list again. Try setting the value of the "length" attribute to 3 and hit Apply. The table now displays only the first 3 rows. Click inside the left table cell and click the <strutslogic:iterate> in the tag ancestor list again. Delete the 3 from the value of the "length" attribute and hit Apply to remove the length constraint. The table now has its original 5 rows.

The row on top is a template row. You can alter it as you would a normal row. The tan rows are locked rows. Their HTML source exists only as a compiled JSP response from the server. You can only affect them by changing the template row. Try boldfacing the word "message" and hitting ctrl-r to refresh. Notice how all the locked rows now contain the boldfaced "message" text.

The main feature of the iterate tag is not repetition of the same data, but its ability to set a bean as the current element of a collection on each iteration. In other words, you can set the iterate tag's "id" attribute to a bean that writes out each member of the collection. You already set the "id" attribute of the iterate tag to "item", so the next step is to insert the "item" bean.

  • The "write" tag is in the struts-bean tag library. Select "struts-bean" from the "Select a Custom Tag Library" drop-down menu and hit Use Tag Library. Again, the default TLD location is correct. The prefix has been changed from "struts-bean" to "strutsbean" since prefixes must be alphanumeric. The default is fine, but you may make it whatever you wish. The namespace instantiation is added to the top of the page, and the "Select Tag to Insert" drop-down menu is populated with the struts-bean tags.
  • Click in the left cell of the template (topmost) table row. Select the <td> tag from the tag ancestor list at the bottom left corner of the document window. Select "write" from the "Select Tag to Insert" drop-down menu and click insert. Enter "item" as the value for the "name" attribute. The content of the <td> tag is replaced with the "write" tag (see Insertion in Things to Watch below for more information on how the extension chooses its insertion scheme).
  • In the document window, the "write" tag populates the left table column with the values from the "list" ArrayList. The content of the locked cells is manipulatable as before. Select the text "Finish report by 6", boldface it, right justify it (Text|Align|Right), and hit ctrl-r to refresh. Notice how the locked cells take on the same formatting. Restore the left justification.
  • Next you will replace the "read" text in the right table column with a button for reading a message. For the tutorial, the button will serve only cosmetic purposes. The "button" tag is in the struts tag library. It generates a localized HTML button.
  • Select "struts" from the "Select a Custom Tag Library" drop-down menu and hit Use Tag Library. The "Select Tag to Insert" drop-down menu populates with the tags of the struts tag library, but the server is not pinged since the tags already exist in local cache, and the namespace instantiation is not added to the JSP since it is already present.
  • Click inside the right template cell and select the <td> tag from the tag ancestor list at the bottom left corner of the document window. Select "button" from the "Select Tag to Insert" drop-down menu and hit insert. For the "property" attribute, enter whatever you like (the property attribute is irrelevant in this context). The struts "button" tag replaces the content of the template cell, and the document window updates with a button in each cell of the right column.
  • Now you will alter the value displayed on the button. Select the button in the document window if it is not already selected. The "Edit Tag" floater populates with the attribute/value pairs of the "button" tag. Enter "Read Message" as the value for the "value" attribute, and hit Apply. The document window refreshes and the buttons now say "Read Message".

The next step will be adding an element to the page that is only visible to certain users. In this case, we will add an "Administer Privileges" button that is only accessible to the admin of the system. We will use the struts-logic "ifParameterEquals" tag to test for this. In a more involved application, we could check the value of a bean set by a "Logon" JSP for more secure authentication, but parameter checking well suites the scope and purpose of this tutorial.

  • Click to the right of the table in the document window and hit return. The cursor should now be under the table to the left.
  • Insert another struts button, and set the "property" value to whatever you like (again the property attribute is irrelevant in this context). The document window refreshes and the button appears below the table. In the Edit Tag floater, set the value of the "value" attribute to "Administer Privileges" in the Edit Tag floater and hit Apply. The button now reads "Administer Privileges".
  • Select the "ifParameterEquals" tag from the "Select Tag to Insert" drop-down menu and hit insert. For name, enter "user", and for value, enter "admin". The "ifParameterEquals" tag is wrapped around the "button" tag.
  • The button disappears. The parameter "user" is set to your name, and the "ifParameterEquals" tag only processes its body content if "user" equals "admin", as you just specified. To make the button show, make a change to the URL Request parameters being sent to the server. Select View|Live Data Settings..., change the value of "user" to "admin", and hit OK. The button reappears.
  • For fun, click the button and set the value of the "onClick" attribute to alert('Administering Privileges'); in the "Edit Tag" floater (being sure to use single quotes and include the semicolon). Hit Apply. This will show a JavaScript message when the button is clicked in a browser.

Now wrap the whole page in a form. The struts tag library provides a custom tag for creating localized forms.

  • From inside the design window, hit ctrl-a to select all the design content.
  • Select the "form" tag from the "Select Tag to Insert" drop-down menu and hit insert.
  • For the "name" attribute, you may enter whatever you wish. For "type", enter "org.apache.struts.example.LogonForm" (case sensitive). That's a class in the site that generates a specific form.
  • The struts "form" tag is wrapped around the selected HTML in the source window. The document refreshes. The red dotted line around the design content is UltraDev's indication that the content is within a form.

The last step will be setting the title of the JSP using a custom tag that generates a localized message. Dealing with tags like <title> that occur before the <body> tag in UltraDev is more complicated than those within the <body> tag (see Selecting in Things to Watch). As a result, inserting a custom tag into the <title> tag will require an extra step.

  • Before you begin, note that the "Title:" text box at the top of the document window says "Untitled Document". You will insert a custom tag inside the <title> tag that uses a bean to generate a localized title.
  • Select View|Head Content, or hit ctrl-shft-w (you should already be in "Code and Design" view mode). The Head Content icons appear in the middle of the document window, between the source window and the design window..
  • Select the title icon, which is the leftmost of the Head Content icons. The <title> tag becomes selected in the source window.
  • You should already be using the struts custom tag library. If not, use it. Select the "message" tag from the "Select Tag to Insert" drop-down menu and click insert.
  • For the "key" attribute, enter "prompt.username". This is the name of a class in the web-inf folder of the site that generates a localized message.
  • The "Title:" text box now says "Username:". Oops! That's the wrong class. You'll have to edit it with the Edit Tag floater.
  • Click inside the <title> and </title> tags in the HTML source window. The Edit Tag floater populates with the attribute/value pairs of the message tag. If you mis-clicked, you will need to reselect the title icon from the Head Content icons before attempting to click inside the <title> and </title> tags again (see the special case in "Selecting" under Things to Watch for an explanation).
  • Change the value of the key attribute to "logon.title" and hit Apply. The document refreshes and the "Title:" text box now reads "MailReader Demonstration Application - Logon", the correct title.

This concludes the construction of the JSP. Hit the F12 key on your keyboard to preview the JSP in your primary browser. It should appear very similar to the version you interacted with in Live Data Mode (note the width of the table depends on the size of the browser window).

The URL Request parameters you specified in UltraDev's Live Data Mode settings are in the URL string of your browser, so all the elements of the page are accessible. Change the value of the "user" parameter in your browser to your name and hit return. The page now says "Messages for [your name]" and the "Administer Privileges" button is not visible. Set the "user" parameter to "admin" once again. The page reads "Messages for admin" and the button reappears. Clicking the button should show the JavaScript alert you previously entered. If you see a JavaScript error, make sure you entered the value correctly in the "Tag Edit" floater.

Your browser display should look something like this:

Messages for: admin
Finish report by 6
Dinner tonight?
Can I borrow your car
(fwd)(fwd)(fwd) re: win millions instantly!
found: 3 watch fobs

Congratulations. This completes the tutorial.

Things to Watch

As discussed under Limitations in the About the Extension section, The Custom Tag Library Extension functions inside a version of UltraDev that was not designed to support custom tag libraries. In fact, the current version of UltraDev (version 4) only claims to truly support JSP 1.0. Combining the current level of support with the fact that (at the time of this writing) the extension is in its initial release, the extension displays certain behaviors of which the reader should be aware.

The JSP translator in UltraDev deals with unfamiliar tags in two possible ways: it either locks them, or it does not. The JSP translator will lock a tag if and only if that tag directly generates an HTML element. For example, the <struts:button> tag directly generates an HTML button, so in Live Data Mode the <struts:button> tag is locked. The advantage to the user of locked tags is that they always appear as visual elements, so they can be selected by clicking on the corresponding HTML element in the document window (i.e. selecting the HTML button in the document window selects the <struts:button> in the source window and populates the "Edit Tag" floater). The disadvantage of unlocked tags is that they cannot be edited using UltraDev's "quick tag editor", nor can they be selected in the tag ancestor list at the bottom left corner of the document window.

Unlocked tags are tags that do not directly generate an HTML element. The <struts:iterate> tag is an unlocked tag. Even though the tags inside <struts:iterate> may generate HTML elements, the tag itself is not translated to an HTML element, so it remains unlocked. The advantage to the user of unlocked tags is that they can always be selected from the tag ancestor list at the bottom left corner of the document window. The disadvantage is that there is no visual element in the document window that can be clicked to select the tag.

The other relevant distinction is between tags with body content and those without.

CTLX is able to recognize, insert, edit, and remove both locked and unlocked tags, with and without body content. Because of their different internal representations, the user and the extension will handle their interaction in different ways.

Selection:

  • For locked tags, click the tag's corresponding HTML element in the design window to select the tag in the source window. The "Edit Tag" floater should update properly.
  • For unlocked tags, in the design window place the cursor inside an element that is surrounded by the tag, and select the tag from the tag ancestor list in the lower left corner of the document window. The "Edit Tag" floater should update properly.
  • If all else fails, place the cursor inside the text of the opening tag in the source window. The "Edit Tag" floater should update properly.
  • Special Case: If the tag you want to select is located before the <body> tag in the document, an additional step is necessary. If the Head Content icons are not already visible, make them so by selecting View|Head Content or hitting ctrl-shft-w. Select one of the head content icons. Now place the cursor inside the opening tag of the desired custom tag and the "Edit Tag" floater should update properly. This extra step is necessary because UltraDev does not call the function to update extension floaters when the user clicks above the <body> tag unless the user's immediately previous selection was to click one of the Head Content icons.
  • If the "Edit Tag" floater does not appear to be populating with the attribute/value pairs of the selected tag, try using one of the other methods described above. In cases where the floater is populated with the wrong custom tag (most likely caused by the special case above), using the Apply or Remove Tag features may raise a harmless JavaScript warning, but should not affect the content of the JSP.

Insertion:

  • If the tag has body content, the tag is wrapped around the current selection. If the current selection is invalid (starts inside the text of an opening tag, or ends in the text of the closing tag) the selection is expanded to encompass the entire tag to prevent invalid HTML.
  • If the tag has no body content, there are two possibilities:
    1. The selection exactly encompasses a single tag, and that tag has body content. In this case, the custom tag is inserted inside the encompassed tag, and replaces that tag's prior body content. An example would be if an entire <title> tag were selected, and the user wanted to replace the "Untitled Document" text inside the tag with a <struts:message> tag.
    2. All other cases. In all other cases, the tag is inserted at the current insertion point, replacing nothing. If there is a selection instead of an insertion point, the tag is inserted at the start of the selection, replacing nothing.

Tags With Contextual Requirements:

  • Many custom tag libraries include tags that require the presence of beans or variables to compile correctly. If one of these requirements is not met, the server will return an error message that will be displayed in Live Data Mode. To avoid such errors, make sure the all necessary beans are deployed on the server, and all necessary variables have been set before enabling Live Data Mode.

Performance in Live Data Mode

  • The first time you use Live Data Mode in any JSP you will experience an extended lag between screen refreshes. This is because UltraDev is pinging Tomcat to translate the JSP into HTML every time you make a change. After the initial translation, the lag will decrease substantially as the software reuses previously compiled code.

Usage With Pre-existing JSPs

  • Editing the custom tags in an already existing JSP is not recommended, as the extension adheres to stricter formatting requirements then a handcoded page may have employed. Additionally, JSPs not following UltraDev's strict formatting requirements may not display properly in Live Data Mode.

Configuring CTLX for Tomcat

  • By default CTLX checks "localhost:8080" for the Tomcat HTTP connection. To change the location and/or port where the extension looks for the Tomcat installation containing the TLDParser servlet, open the file "[ultradev]/Configuration/Commands/customTags/useTagLibs.js" and change the value of the ctServletURL variable from http://localhost:8080/TLDParser/servlet/TLDParser to http://[your-server]:[your-port]/TLDParser/servlet/TLDParser.

Usage of UltraDev Version 1

  • Using CTLX with a version of UltraDev prior to 4 is not recommended. In particular, the prior version has a bug in the API that causes all extension floaters to cease refreshing if the user ever switches to a program other than UltraDev or closes the floaters after they have been opened. Other discrepancies exists as well.

Other Inexplicable Behavior

  • Tomcat with an enabled Java SecurityManager requires a grant to read property permissions for the TLDParser servlet. Without it, the Use Tag Library floating palette will display a stack trace from Tomcat instead of the list of available tag libraries.
  • If you experience other usual behavior, before reporting a bug, try refreshing Live Data Mode (ctrl-r), and if the problem persists, try restarting UltraDev, and if the problem persists, try restarting Tomcat.
  • Control-z undoes the last action in UltraDev :)

Documentation by Dan Mandell [dmandell@stanford.edu]