WOW Custom Row Display

infestationwatchΛογισμικό & κατασκευή λογ/κού

28 Οκτ 2013 (πριν από 3 χρόνια και 9 μήνες)

81 εμφανίσεις

P LANETJ CORP ORATI ON

WOW
Custom Row Display




PlanetJ Corporation

Email support
@planetjavainc.com




























Introduction


Web Object Wizard (WOW)
has
an open API and enables unlimited customization.


This document will de
scribe a techniq
ue 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 sup
port prompting. The user wishes
to create a custom scr
een using
HTML tags. The following sample uses the WOW sample table PJDATA.EMPLOYEE.



Steps:


1.

Create a normal WOW SQL Operation:

a.

Select * from pjdata.employee where lastname = ?

2.

Execute the test the operation.

3.

Ex
amine and then copy the sample c
ustom J
SP to a unique file name.

4.

Specify your new JSP in your operation created in step 1.

a.


b.

In the sample, the JSP is in: /user/shopvac/custom_row_details.jsp

c.

Make sure the JSP is in your application server. For tomcat, my JSP is in:

i.

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

5.

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.co
mponent.*,






planetj.html.*"
%>

<%



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

AbstractContext context =
DataEngineManager.getCurrentContext(request);






// Only generate if prompted via a ?

if

(context !=
null

&&
context.isContainsDispla
yParameters()) {


// 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 su
pport



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


RowCollection rc =
DataEngineManager.getCurrentRowCollection(reques
t);




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


if

(rc !=
null

&& !rc.isEmpty())


{



// ge
t 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
>


<%

}
%>