Default code templates of the web UI framework

There are several code templates that come as default in the web UI Framework. Some of those code templates include resources, resource permissions, and menus.

The Web UI Framework includes the following templates that can be used to update different WUF screen components during runtime:

  • Mashup APIs
  • Struts actions
  • JSB (JavaScript Builder)
  • Resources
  • Resource permissions
  • Resource and permissions (combines resource and resource permission templates)
  • Menus

WUF uses template metadata to create (by default) XML code templates, which in turn are used to generate XML code that is used by the application. However, you can define a custom template that is not an XML template.

Template updates occur in the following ways:

  • In the current login session (all templates). The changes last only as long as you are logged in. You can test the changes while you are logged in.
  • In the database (all templates except mashup and JSB). The changes are permanent unless you delete them. Updates of components in the database are an alternative to updates of those same components in the Applications Manager.

The following sections describe how each template works and the XML elements for each kind of component.

Mashups

This updates only the mashup registry that is in the session (but not permanently in the database).

The generated template code can be used to update mashup.xml files, through copying and pasting. If you are using Aggregator mashups or adding more attributes to the mashup code, you must define your own template.

The following variables are used in the default code template for mashups:

Item Description Source
id Uniquely identifies a mashup in the application. User-entered.
description Information about mashup. User-entered.
apiName API that is being used in mashup. User-entered.
input Input to mashup. User-entered.
outputTpl Output from server. User-entered.

Struts

Struts can be updated by adding the generated code to the application's struts.xml file if:

  • The struts.xml file is removed from the JAR file in which it is packaged and placed under the WEB-INF/classes directory.

    For example, in the case of stk, you would remove the stk_struts.xml file from the platform_ui_demo_app.jar file and place it under the WEB-INF/classes directory.

    Any changes that you make to the struts.xml file would be reflected in the application. If two actions have the same ID, then the action that appears last in the file would be picked up in the application.

  • The Struts dev mode is enabled (turned on automatically if the war file is built with -Ddevmode=true).
  • The application is deployed as an exploded war file by using the following command:
    buildwar.sh -Dwarfiles=<war file name> -Dappserver=<appserver> -Dnowebservice=true -Ddevmode=true

    When using WebLogic 12.1.2, use the following command:

    buildwar.sh -Dwarfiles=<war file name> -Dappserver=weblogic -Dnowebservice=true -Ddevmode=true Dwls-12=true

The following variables are used in the default code template for Struts actions:

Item Description Source
actionName Uniquely identifies an action in the application. User-entered.
id ID of mashup used/called. User-entered.
input_ns Namespace used for input. User-entered.
output_ns Namespace used for output. User-entered.
success_jsp_path JSP to load if the action is successfully completed. User-entered.

JSB (JavaScript builder)

This updates only the JSB registry that is in the session (but not permanently in the database).

The following variables are used in the default code template for JSB (JavaScript Builder):

Item Description Source
proj_name Name of the project. User-entered.
target_name Identifies a JavaScript library. Should be unique in the application. User-entered.
target_file Directory/file path for JavaScript library. User-entered.
loadAfter Specifies the library after which the current JSB library should be loaded. User-entered.
config_js Path of the config.js file for the screen. User-entered.
js Path of the JavaScript file for the screen. User-entered.
bundle_js Path of the bundle JavaScript file for the screen. User-entered.

Resources

This updates or adds the resource in the current session and permanently in the database.

The following variables are used in the default code template for resources

Item Description Source
app_code Application code. User-entered.
app_name Application name. User-entered.
parent_resource_id Resource ID of the parent resource. User-entered.
resource_create_type Resource create type (for example, USER). User-entered.
resource_desc Information about the resource. User-entered.
resource_key Unique key of the resource. User-entered.
url The action URL for the Struts action. User-entered.

Resource permissions

This updates or adds the resource permissions both in the current session and permanently in the database.

The following variables are used in the default code template for resource permissions:

Item Description Source
resource_perm_key Resource permission key. User-entered.
user_group_id The ID of the group to which the user belongs. User-entered.
user_group_key The key of the group to which the user belongs. User-entered.

Resource and permission

This combines the resource and resource permission templates. It updates or adds resources and resource permissions both in the current session and permanently in the database.

The following variables are used in the default code template for resources and permissions:

Item Description Source
app_code Application code. User-entered.
app_name Application name. User-entered.
parent_resource_id Resource ID of the parent resource. User-entered.
resource_create_type Resource create type (for example, USER). User-entered.
resource_desc Information about the resource. User-entered.
resource_key Unique key of the resource. User-entered.
url The action URL for the Struts action. User-entered.
resource_perm_key Resource permission key. User-entered.
user_group_id The ID of the group to which the user belongs. User-entered.
user_group_key The key of the group to which the user belongs. User-entered.

Menus

This updates or adds a menu both in the current session and permanently in the database. It provides an alternative to the Applications Manager method of creating a menu.

The following variables are used in the default code template for menus:

Item Description Source
menu_desc Information about this menu entry. User-entered.
menu_key Key/ID used to uniquely identify this menu. User-entered.
menu_type The menu type. User-entered.
parent_menu_key The menu key of the parent. User-entered.
resource_key Key used to identify the source. User-entered.