31 Configure the Element

The Element form (CS Element) is used to create the CSElement's element, define the element file type (XML, JSP, or HTML), provide the element logic, and name the element. For example:

  • The Create Element field offers a choice of XML, JSP, or HTML file types for the element logic, and is used to seed the Element Logic field with standard stub code (which you have to include in any element that you create).

  • When you use the Create Element field to create, for example, a .jsp file, WebCenter Sites adds JSP taglib statements and the render.logdep tag to the Element Logic field by default so that the compositional dependency between this CSElement asset and pages that are rendered from this element is logged. For other file types, WebCenter Sites adds code specific to the file type. You will add your own code to the Element Logic field.

    For information about dependencies, see About Dependencies. For help with coding the element logic, see Coding Elements for Templates and CSElements.

  • The Element Storage Path/Filename field names the file that holds the element logic and specifies the path to the file.

When the CSElement is saved, field values in the Element screen are written to a row (representing the element) in the ElementCatalog table.

Note:

About Selecting an Existing Element

In the steps that follow, we assume you are creating a new element for the CSElement asset. If, however, you are migrating assets from an earlier WebCenter Sites release and want to reuse an existing element, you have to identify the element correctly so that WebCenter Sites can find it and associate it with the CSElement asset.

To select an existing element

  • (Optional). In the ElementCatalog Description field, type a description of the element.

  • In the Element Storage Path/Filename field, enter a value according to the convention in Naming the CSElement.

  • If your site design requires it, enter the appropriate arguments in the element parameter fields. For instructions, see step Link text cannot be resolved.

  • Save and re-open the CSElement asset.

WebCenter Sites checks for the presence of an element with the correct name:

If the element has been correctly named, WebCenter Sites recognizes the element and displays its code in the Element Logic field.

If the named element does not exist (or is incorrectly named), WebCenter Sites does nothing. When you inspect or edit the CSElement asset, WebCenter Sites displays a message stating that there is no root element in the form. As soon as you code the element and give it the correct name, WebCenter Sites detects it and associates it with the CSElement asset.

To configure a new element, enter the fields in the CSElement Element Form.

  1. In the Create Element field, do one of the following:
    • To create an .xml file, click XML. The code that is pasted in comes from the OpenMarket\Xcelerate\AssetType\CSElement\modelXML.xml element and can be modified to use custom default logic.

    • To create a .jsp file, click JSP. The code that is pasted in comes from the OpenMarket\Xcelerate\AssetType\CSElement\modelJSP.xml element and can be modified to use custom default logic.

    • To create an .html file, click HTML. The code that is pasted in comes from the OpenMarket\Xcelerate\AssetType\CSElement\modelHTML.xml element and can be modified to use custom default logic.

    WebCenter Sites populates the following fields:

    • Element Storage Path/Filename field. Do not change the value of this field.

      This field displays the element file name preceded by the path to the element file. By default, the file takes the name of the CSElement asset (entered in step ) followed by the file extension:

      CSElementName.xml_or_jsp_or_html

      When you save the CSElement asset, the value in this field is written to the url column of the ElementCatalog table, for the row that represents the element.

    • Element Logic field with a header and other information.

      For example, if you clicked the JSP button, WebCenter Sites sets a tag library directive for some common WebCenter Sites JSP tag libraries (asset, siteplan, render). WebCenter Sites also sets the beginning and ending cs:ftcs tags, and a RENDER.LOGDEP (render:logdep) tag to mark a compositional dependency between the CSElement asset and any page or pagelet rendered by the element.

  2. The Rootelement field is pre-populated with the name of the element file (CSElementName.xml_or_jsp_or_html). Do not change the value of this field.

    The root element is listed by this name in the ElementCatalog table. When you create code that calls this element (RENDER.CALLELEMENT), this is the name you should use. It uses the name of the CSElement asset by default.

  3. (Optional). In the ElementCatalogDescription field, type a description of the element.

    When you save the CSElement asset, information in this field is written to the description column for the element entry in the ElementCatalog table.

  4. (Required). In the Element Logic field, code your element. Be sure to enter all of your code before the ending cs:ftcs tag.

    If you are using JSP, remove the comments from the taglib directives that describe the tag families you are using.

    For help with this step, see Coding Elements for Templates and CSElements.

    Note:

    Ensuring Template Sharing or a Replicable Site: To share your CSElement or make the current site replicable, ensure the CSElement's element logic does not directly refer to assets, asset types, attribute names, or template names. Instead, use the render:lookup tag and prescribed keys as explained in Template Sharing and Site Replication. In Configure the Map you will map the keys to the asset information that must be accessed for use in the element logic.

    Calling a Template: Templates should always be called by the render:calltemplate tag, and never the render:callelement tag or render:satellitepage tag.

  5. The Element Parameters field and Additional Element Parameters fields are used to enter variables or arguments that can be passed to the element, if the site design requires them.
    • Element parameters field. WebCenter Sites populates this field with the CSElement ID (eid), generated by WebCenter Sites as a unique identifier of the CSElement asset. Do not change or delete this value.

      This field corresponds to the resdetails1 column of the ElementCatalog table. When you save the CSElement, WebCenter Sites writes the CSElement ID to the resdetails1 column, in the row that represents the CSElement.

    • Additional Element Parameters field. WebCenter Sites leaves this field blank.

      This field corresponds to the resdetails2 column of the ElementCatalog.

    If your site design requires you to use variables in addition to eid, enter the variables into one of the fields above. Enter them as name=value pairs with multiple arguments separated by the ampersand (&) character. For example:

    MyArgument=value1&YourArgument=value2
    

    Each field supports up to 255 characters.

    For more information about WebCenter Sites variables, including scope and precedence, see Website Development with Tag Technologies.

  6. Click Continue to open the Map screen.