[PlanetJ Corporation]

[info@planetJavaInc.com]

[www.PlanetJavaInc.com]

 


 

WOW Custom Row Display

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Introduction

 

Web Object Wizard (WOW) has an open API and enables unlimited customization.  This document will describe a technique available to customize a screen for display via a WOW operation.

 

Custom UI

 

This sample assumes a standard WOW operation is run which results in 1 record being returned.  This sample does not support prompting.  The user wishes to create a custom screen using HTML tags.  The following sample uses the WOW sample table PJDATA.EMPLOYEE.

 

Steps:

  1. Create a normal WOW SQL Operation:
  1. Select * from pjdata.employee where lastname = ?
  1. Execute the test the operation.
  2. Examine and then copy the sample custom JSP to a unique file name.
  3. Specify your new JSP in your operation created in step 1.
  1. In the sample, the JSP is in: /user/shopvac/custom_row_details.jsp
  2. Make sure the JSP is in your application server.  For tomcat, my JSP is in:

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\wow65dev\user\shopvac

Test, debug, and enhance as needed.

The results of this sample are shown below:

Sample JSP Source:

 <%@ page

        import="planetj.dataengine.*,

                    planetj.database.*,

                    planetj.html.component.*,

                    planetj.html.*"%>

<%

 

// Support prompting if needed... IE.. where field1 = ?

AbstractContext context = DataEngineManager.getCurrentContext(request);                      

// Only generate if prompted via a ?

if (context != null && context.isContainsDisplayParameters()) {

// use the specified parameters JSP

String paramsJsp =  IDataEngine.DEFAULT_PARAMS_JSP;

%>

<table cellpadding="0" cellspacing="0" border="0">

         <jsp:include page="<%= paramsJsp %>" flush="true" />

</table>

<% 

}

// End of prompting support

        // get the current RowCollection which is like an array of records

        RowCollection rc = DataEngineManager.getCurrentRowCollection(request);

        // If the sql has run and there are records returned.

        if (rc != null && !rc.isEmpty())

        {

                // get the 1st row, Java starts with 0 instead of 1

           Row row = rc.getRow(0);              

               // We have data, we can display it however we want.

          // lastname, workdept and firstnme are DB field names so adjust as needed.

 

            String fn = row.getValueAsString("firstnme");

            String ln = row.getValueAsString("lastname");

            String workDept = row.getValueAsString("workdept");

%>

<h2>

        This is a custom UI

</h2>

<h2>

        Add any HTML you would like here.

</h2>

<Table>

        <Tr>

           <td><%= fn %></Td>

           <td><%= ln %></Td>

        </Tr>

        <Tr>

           <td><%= workDept %></Td>

        </Tr>

</Table>

<% } %>

 

 

 

© PlanetJ Corporation

info@planetjavainc.com

Phone: 760-432-0600