This example shows two JSP pages that use the DataWindow tag. The first, Departments.jsp, uses a nested DWColumnLink tag to pass data to the Employees.jsp page. The link is from the dept_id column of the d_departments DataWindow that uses the department table in the EAS Demo database. In the DataWindow painter, you must set the tab order for this column to 0 or the Protect property to 1 in order for the link to work.
The deployment descriptor for the application must include a taglib element that associates the short name “DW100” with the DataWindow100.tld file in the Web application’s /WEB-INF/tlds directory:
<taglib> <taglib-uri>/DW100</taglib-uri> <taglib-location>/WEB-INF/tlds/DataWindow100.tld </taglib-location> </taglib>
The deployment descriptor for the application is the file web.xml, which resides in the Web application’s WEB-INF directory. For more information, see the section on editing a JSP deployment configuration in the Working with Web and JSP Targets book.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <%-- Import tag class--%> <%@ taglib prefix="webdw" uri="/DW100" %> <HTML> <HEAD> <META HTTP-EQUIV="PowerSiteData" NAME="SERVERLANGUAGE" CONTENT="JavaScript"> <TITLE></TITLE> <META http-equiv="Content-Type" content="text/html"> <META content="MSHTML 5.50.4522.1800" name="GENERATOR"> </HEAD> <BODY PSPARAMS=""> <%-- Use DataWindow custom tag--%> <webdw:DataWindow argument="" selfLinkArg="" logpass="" jaglogpass="" dbms="ODBC" servername="" clientScriptable="true" clientFormatting="true" action="" selfLink="dwpage2.jsp" jaglogid="jagadmin" dwHtmlObjectName="dwTest" logid="" lock="" clientEvents="true" clientValidation="true" libName="f:\\Mywork\\Pbjsp\\d_departments.srd" database="" dbparm="ConnectString='DSN=EAS Demo DB V10; UID=dba;PWD=sql',ConnectOption= 'SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'" jagservername="myEASserver:9000" dwName="" context="" allowForm="true" > <webdw:DWColumnLink sColLink="Employees.jsp" sColLinkArgs="dept_id='dept_id'" sColLinkTarget="" sColumnName="dept_id"> </webdw:DWColumnLink> </webdw:DataWindow> </BODY> </HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <%@ taglib prefix="webdw" uri="/DW100" %> <HTML> <HEAD><TITLE> DataWindowJSP Example </TITLE></HEAD> <BODY> <H2> Basic JSP Datawindow: Employee List Report </H2> <%! String strDept; %> <% strDept = psDocument.GetParam("dept_id");%> <webdw:DataWindow libName="d:\\Mywork\\Pbjsp\\d_employees.srd" dwName="" allowForm="true" clientValidation="true" clientEvents="true" clientScriptable="true" clientFormatting="true" dbms="ODBC" dbparm="ConnectString='DSN=EAS Demo DB V10; UID=dba;PWD=sql',ConnectOption= 'SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'" lock="" logid="" logpass="" database="" servername="" jagservername="myEASserver:9000" jaglogid="jagadmin" jaglogpass="" selfLink="Employees.jsp" selfLinkArg="" action="" context="" argument="<%=strDept%>" dwHtmlObjectName="dwTest" pageSize="10" > </webdw:DataWindow> </BODY></HTML>
JSP deployment controller adds server script When you deploy the JSP target from PowerBuilder, the JSP deployment controller adds the following server script to the top of each JSP page:
<%@ page import="com.sybase.powerbuilder.jspobject.*" %> <% // global instance for the page PSDocumentClass psDocument = new PSDocumentClass (request, response, out, application); PSSessionClass psSession = new PSSessionClass(session); PSServerClass psServer = new PSServerClass(psDocument); %>