Scenario 1: Creating a simple custom tool

This scenario explains how to create a simple custom tool called UIFrameworkTest. You can use the same procedure to deploy custom JSP files in the IBM® Product Master environment.

Before you begin

Before deploying your custom code (JSPs and Java command objects) you must make provision to register and deregister servlet threads.
  • Add customTool="true" for custom flows, both flows and asynchronous, in the flow-config.xml file:
    <flow path="testCommand"
        command="test.TestCommand"  
        method="getAction"   
        isCustomTool="true"
    >
    This file is located in the $TOP/etc/default directory.
  • Add header and footer includes that wrap the custom JSP code in a try/catch/finally block:
    Header
    Place this include after any declarations and anything else that will define objects at the JSP class level, such as declarations that define methods and member variables. The include file mentioned below opens a try block which will be finished by the closing include. This try block MUST include all the code in the main method of the JSP. Avoid using static declarations that access the database.
    <%@ include file="/js/utils/customToolHeader.jsp.include" %>
    Footer
    Place this include at the end of the file. The include file mentioned below closes the try block that is opened in the header include.
    <%@ include file="/js/utils/customToolFooter.jsp.include" %>

Procedure

  1. Create the custom tool in the user interface.
    1. Open the Scripts Console.
    2. Select Custom Tools.
    3. Click the new button.
    4. Specify any input parameters and other settings. For this scenario specify None for the input parameters. Provide a custom tool name, for example: UIFrameworkTest and select the ASP/JSP type.
    5. In the scripts editor, insert the following script that generates the HTML that you need for the custom tool. For example:
      Welcome to the new UI framework 
      <HR>
      <a href="/newhomepage.wpc"> New Custom Page </a>
    6. Click Save.
  2. Edit your flow-config.xml file.
    Add the following piece of code under the flow tag:
    <flow path="newhomepage" command="com.ibm.ccd.ui.util.DefaultNavigator" method="">
    <flow-dispatch name="success" location="/user/welcome1.jsp" dispatchType="forward" />
    </flow>
    

    Although you can directly call the welcome1.jsp, this code manages the product session. If there is a timeout, then this code forwards the user to the login page.

  3. Create a simple JSP page and save it as welcome1.jsp.
    <BR>
    <BR>
    <HR>
    <%
    out.println("Welcome to the new UI extension framework ");
    %>
    <HR>
    
  4. Add the custom code or JSP files in the $TOP/public_html/user directory.
  5. Add Java code, if any.
    1. Create a JAR file for the Java™ command utilities code that your wrote for the new extension.
    2. Add the jar file to the server.
      Note: In this scenario, no Java command class is required because you are just forwarding the request. You will use DefaultNavigator.java, which is packed with your application.
  6. Restart the Product Master application.
  7. Change the settings in the Product Master.
    1. In the User Settings page, select the new custom tool as the new default starting page and click Save.
    2. Reload the screen to see the new custom tool with the link "New Custom page". Click this link to open the new page, which is welcome1.jsp.
      You see the message Welcome to the new UI extension framework.