Previous Next vertical dots separating previous/next from contents/index/pdf

templateProject.xml Configuration File

The templateProject.xml file configures a project as a JSP template project. A JSP template project defines a set of JSP templates that are added to list of default JSP template options (this list is available at Window > Preferences > File Templates > Default JSP Template).

A template project contains at least one template definition, at least one source file definition used in template processing, and any number of resource definitions (GIF, JPG, etc.) associated with templates.

General Structure

<template-project>
    <template>
        <description>
        <source-ref>
        <resource-ref>
    <source>
    <resource>

<description>

The <description> element is the child element of the <template> element. The template author should describe the properties of the template here.

<template-project>
    <template>
        <description>

Syntax

<description>
   string_value
</desciption>

Attributes

none.

Occurrences

Minimum occurrences: 0

Maximum occurrences: 1

Hierarchy

Parents: <template>

Children: none.

<resource>

Describes the template file that is copied when a template is processed (when a new JSP page is created). String substitution takes place on the file as it is copied into place.

<template-project>
    <resource>

Syntax

<resource id="id_value" path="string_value" />

Attributes

Attribute Description
id Required string. ID unique to other resource elements within this template project.
path Required string. Path to the resource element on disk relative to the projectTemplate.xml file.

Occurrences

Minimum occurrences: 0

Maximum occurrences: unbounded

Hierarchy

Parents: <template-project>.

Children: none.

<resource-ref>

Describes a resource that is to be copied without string substitution when processing a template.

<template-project>
    <template>
        <resource-ref>

Syntax

<resource-ref resource="resource_id" outputpath="path_string"/>

Attributes

Attribute Description
resource Required string. ID to a resource element in this template project.
outputpath Required string.

Occurrences

Minimum occurrences: 0

Maximum occurrences: unbounded

Hierarchy

Parents: <template>.

Children: none.

<source>

Describes a file in the standard Velocity template syntax. See http://jakarta.apache.org/velocity/index.html for details.

<template-project>
    <source>

Syntax

<source id="id_value" type="type_string" />

Attributes

Attribute Description
id Required string. ID unique to other source elements within this template project.
type Required string. Extension to be used when this file is output if no extension is provided in the output path when processed. For example, if this template represents a JSP file, then the type attribute can be set to jsp such that if the template is processed with an output path of MyProject/MyFolder/MyFile then MyProject/MyFolder/MyFile.jsp will be created.

Occurrences

Minimum occurrences: unbounded

Maximum occurrences: 1

Hierarchy

Parents: <template-project>

Children: none.

<source-ref>

Describes a file to be processed for string variable substitution within a template.

<template-project>
    <template>
        <source-ref>

Syntax

<source-ref source="id_value" context="context_string" contextAdapter="contextAdapter_string" />

Attributes

Attribute Description
source Required string. ID to a source element in this template project.
context Required string. When a template is processed, a context contains the variables and their values used in string substitution. For example, when processing a JSP template the context JSPBaseBean will be passed to the template for processing. Specifying JSPBaseBean in the context attribute indicates that the properties in the JSPBaseBean shall be used for string substitution in the template.
contextAdapter Optional string. A context adapter can add and modify the context variables given to a template before processing. This is useful when a template contains two source-ref elements that use the same context, but the output file names of the two source-ref elements are different.

Occurrences

Minimum occurrences: 1

Maximum occurrences: unbounded

Hierarchy

Parents: none.

Children: <template><source>.

<template>

A template is the logical set of files that are created when the template is selected for processing. In other words, the template is the definition of what files are output if this template is processed.

<template-project>
    <template>
        <description>
        <source-ref>
        <resource-ref>

Syntax

<template id="" typeClass="" name="" icon=""> templateString </template>

Attributes

Attribute Description
id Required string. A string ID value that must be unique within this template-project.
typeClass Required string. The class of template and identifier of the string substitution context
type. For example, a typeClass value that specifies a JSPBean will
indicate that this template is only applicable when creating a JSP file
and the string substituion variables within are limited to those properties
in the JSPBean definition.
name Required string. User-defined name of the template that is visible where template
selection is possible.
icon Optional string. Some templates can be selected in the Workshop UI. An icon is the path
to an image file and is relative to the XML file that implements this.

Occurrences

Minimum occurrences: 1

Maximum occurrences: unbounded

Hierarchy

Parents: <template-project>.

Children: <description>, <source-ref><resource-ref>.

<template-project>

A template-project defines a set of templates that can be used in file generation actions that take advantage of file templates. A template project contains at least one template definition, at least one source file definition used in template processing, and any number of resource definitions used to copy binary resources associated with templates.

<template-project>
    <template>
    <source>
    <resource>

Syntax

<template-project icon="string_path">
    children_elements
</template-project>

Attributes

Attribute Description
icon Optional string. This icon is displayed in the Workshop for WebLogic user interface. The path to an image file relative to the templateProject.xml file.

Hierarchy

Parents: none.

Children: <template><source><resource>.

Related Topics

Controlling Web Application Look and Feel with JSP Templates

Authoring JSP Template Projects

 

Skip navigation bar   Back to Top