To update the plugin.xml file for a visualizer plug-in:
Open the plugin.xml file for editing.
Just after the <runtime> tag, add the following tags. Note that
the data and time example we are using refers to specific visual custom tags
(VCT).
<requires>
<import plugin="com.ibm.etools.webedit.core"/>
</requires>
<extension point="com.ibm.etools.webedit.core.visualCustomTag">
<vtaglib uri="/WEB-INF/lib/sample.jar">
<vtag name="date"
class="com.ibm.etools.webedit.vct.sample.DateTimeTagVisualizer"
description="Dynamically outputs current date and time"/>
</vtaglib>
</extension>
In the above example, you used the <requires> and <import> elements
to specify what other plug-ins the visualizer plug-in needed. Then, you imported
the com.ibm.etools.webedit.core plug-in, and used the <extension> element
to specify what this plug-in contributes. The plug-in connects to the extension
point specified by the <extension> element's point attribute.
The <vtaglib>
element is similar to a <taglib> and specifies the VCTs that are available.
The URI attribute of the <vtaglib> element serves as an identifier for
the VCTs. When Page Designer discovers a custom tag, it looks for the taglib
directive declaring the custom tag. It gets the URI attribute value of the
taglib directive and tries to match it with the URI attribute of the <vtaglib>
element. When a match is found, that plug-in is used to visualize the custom
tag. Thus, the value of <vtaglib> element's URI attribute must be the same
as the URI value specified in the taglib directive of the JSP page for the
visualizers to work.
The <vtag> element specifies the name of the
VCT and the visualizer Java™ class. In the example, the tag is date
and the visualizer that is executed is com.ibm.etools.webedit.vct.sample.DateTimeTagVisualizer.
You can write some comments in the description attribute.
Before you create the JSP file, you must add additional plug-ins.
Select Window > Preferences from the menu bar. The Preferences page
appears.
Select Plug-in Development > Target Platform from the list. Click Not
In Workspace and then click OK.
Update the Java classpath to include the imported plug-in
classes: org.apache.xerces and com.ibm.etools.webedit.core.
Right-click the plug-in project in the Package Explorer. Select Update
Classpath from the pop-up menu. The Java Classpath dialog
box opens.
Click Finish. The Java classpath
of the plug-in project is updated to include the two plug-ins.
Now you are ready to use the visual custom tag in a JSP page.