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

Authoring JSP Template Projects

This topic explains how to create a JSP template project. A JSP template project contains one or more JSP templates and adds those templates to the list of possible default JSP templates. For more information on setting the default JSP template see Controlling Web Application Look and Feel with JSP Templates.

Creating a JSP Template Project

Any project can be converted into a JSP template project, provided it has the appropriate the project nature. To define a project as a JSP template project, add the template project nature to the project's .project file:

    <natures>
        ...
        <nature>com.bea.workshop.common.filetemplate.core.templateProjectNature</nature>
        ...
    </natures>

The .project file resides in the root of a project directory. To view the .project file, switch to the Navigator view: Window > Show View > Navigator.

The template project nature will cause Workshop for WebLogic to recognize the project as a template project.

JSP Template Project Structure

A JSP template project consists of the following elements:

The set of files contained in a give template is defined by the templateProject.xml file. The following sample templateProject.xml file defines one template called "BEA Branded NetUI JSP". Multiple templates can be defined in a given templateProject.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<template-project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <template id="com.bea.demo.filetemplate.NetUIJSP"
            name="BEA Branded NetUI JSP"
            typeClass="com.bea.workshop.web.jsp.core.beans.JSPBaseBean">
    <description>A NetUI-enabled JSP with BEA Branding</description>
    <source-ref context="JSPBaseBean" source="com.bea.demo.filetemplate.NetUIJSP.source" />
    <source-ref context="FileTemplateBean" source="com.bea.demo.filetemplate.dataGrid.css.source" />
    <resource-ref resource="com.bea.demo.filetemplate.logo_bea_tl.gif.source" outputpath="WebContent/resources/images/logo_bea_tl.gif" />
    <resource-ref resource="com.bea.demo.filetemplate.rt_blue_bkgnd.jpg.source" outputpath="WebContent/resources/images/rt_blue_bkgnd.jpg" />
    <resource-ref resource="com.bea.demo.filetemplate.sp.gif.source" outputpath="WebContent/resources/images/sp.gif" />
  </template>
  <source id="com.bea.demo.filetemplate.NetUIJSP.source" file="WebContent/index.jsp" type="jsp"></source>
  <source id="com.bea.demo.filetemplate.dataGrid.css.source" file="WebContent/resources/datagrid.css" type="css"></source>
  <resource id="com.bea.demo.filetemplate.logo_bea_tl.gif.source" path="images/logo_bea_tl.gif" />
  <resource id="com.bea.demo.filetemplate.rt_blue_bkgnd.jpg.source" path="images/rt_blue_bkgnd.jpg" />
  <resource id="com.bea.demo.filetemplate.sp.gif.source" path="images/sp.gif" />
</template-project>

For information on creating a templateProject.xml file, see templateProject.xml Configuration File.

For an example JSP template project open the SamplesWorkspace. Instructions on opening the SamplesWorkspace are available at Opening a Sample Workspace.

Supported Character Encodings

Because of the way templates are processed, the files included in a template must to be encoded in UTF-8. Any other character encoding will result in an error.

JSP Template Plugins

A JSP template project can also be packaged as a plugin. Template plugins are nothing more than template projects that have the templateProject plugin point defined.

For an example of a template plugin see BEA_HOME/tools/workshop/com.bea.workshop.netui.core_1.0.0

Upgrading JSP Template Projects from Workshop for WebLogic Version 9.2 to 10.0

You must make the following changes to your JSP template projects after upgrading from version 9.2 to 10.0.

  1. In the templateProject.xml file, occurrences of com.bea.wlw.jsp.core.beans.JSPBaseBean should be changed to com.bea.workshop.web.jsp.core.beans.JSPBaseBean.
  2. In the templateProject.xml file, occurrences of com.bea.wlw.jsf.core.beans.JSFBaseBean should be changed to com.bea.workshop.web.jsf.core.beans.JSFBaseBean.
  3. In the .project file, the project nature should be changed from com.bea.wlw.filetemplate.core.templateProjectNature to com.bea.workshop.common.filetemplate.core.templateProjectNature.

Note that the .project file is editable from the Navigator view (Window > Show View > Other > General > Navigator).

Related Topics

Controlling Web Application Look and Feel with JSP Templates

templateProject.xml Configuration File

 

Skip navigation bar   Back to Top