I have created a simple WebApp using the wizards in WDSC. Input form sends
select criteria to jsp which pulls data from iSeries table and displays output.
This works great if I run it in a Websphere test server running on the client
workstation. It does not work correctly if running on a Tomcat test server
running on the client or if deployed to a Tomcat server running on the iSeries. 

It returns the correct number of records in the output.jsp but they are all
repeats of the first record. There are no error messages and since it returns
some 'real' data, the connection must be working.

I first tried this using Tomcat 4.1.3 then upgraded to 5.5.7 with the same
results. 

Attached is wizard generated output.jsp code:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>

<%@ page import="java.util.*" 
contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" 
%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@ taglib uri="/WEB-INF/lib/jspsql.jar" prefix="dab" %>

<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
%>
<META name="GENERATOR" content="IBM WebSphere Studio">
<TITLE>Select Master View</TITLE>


<!--Styles-->
<STYLE TYPE="text/css">
<!--
H1 {
        text-align: center;
}
-->
</STYLE>

<!--Style Sheet-->
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
</HEAD>

<BODY>

<%--Store input filters into the session--%>
<%
if(request.getParameter("new_input") != null){
   if(request.getParameter("VNDNR") != null){
      session.setAttribute("VNDNR", request.getParameter("VNDNR"));
   }
}
%>

<%--Get host variables--%>
<%
String inputVNDNR = (String) session.getAttribute("VNDNR");  
%>
<%-- Connect to the database --%>
<%! com.ibm.db.beans.DBConnectionSpec dsSpec = null; %>
<%
if (dsSpec == null) {
%>
<dab:driverManagerSpec id="MLDATA_CRPRCPTSConnection" scope="page"
        userid='<%=config.getInitParameter("username")%>'
        password='<%=config.getInitParameter("password")%>'
        driver='<%=config.getInitParameter("driverName")%>'
        url='<%=config.getInitParameter("url")%>' />
<%
   dsSpec = MLDATA_CRPRCPTSConnection;
 }
%>

<%--Execute the query--%>
<dab:select id="select_master" scope="request"
        connectionSpecRef="<%=dsSpec%>">
        <dab:sql>
      SELECT MLDATA.CRPRCPTS.ITNBR, SUM(MLDATA.CRPRCPTS.REQQT) FROM
MLDATA.CRPRCPTS WHERE MLDATA.CRPRCPTS.ORDTYP = 'P' AND MLDATA.CRPRCPTS.VNDNR =
:VENDOR GROUP BY MLDATA.CRPRCPTS.ITNBR ORDER BY ITNBR ASC       
   </dab:sql>
        <dab:parameter position="1" type="CHAR" value="<%=inputVNDNR%>" />
</dab:select>

<!--Java Script-->
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function submitForm(nav){

   document.myForm.elements["command"].value = nav
   
   index = document.myForm.elements["selected_index"].value
   if(nav == "MLDATA_CRPRCPTSDetailsView" && index == "-1"){
      alert("You must first make a selection")
   }
   else if(nav == "MLDATA_CRPRCPTSDetailsView"){
      MLDATA_CRPRCPTS_ITNBR_ID = "MLDATA_CRPRCPTS_ITNBR" + index
      document.myForm.elements["MLDATA_CRPRCPTS_ITNBR"].value =
document.myForm.elements[MLDATA_CRPRCPTS_ITNBR_ID].value 
      document.myForm.submit()
  }
  else{
     document.myForm.submit()
  }
}

function setSelectedIndex(index){
        document.myForm.elements["selected_index"].value = index
}
//-->
</SCRIPT>
<!--Banner-->
<H1>Select Master View</H1>

<HR>


<!--Navigation-->
<FORM name="myForm" action="MLDATA_CRPRCPTSController"
        method="POST"><A
        href="javascript:submitForm('MLDATA_CRPRCPTSInputForm')">Back</A> <A
        href="javascript:submitForm('MLDATA_CRPRCPTSMasterView')">Refresh</A>
<!--Hidden Variables-->
<INPUT TYPE="hidden" NAME="command" VALUE="MLDATA_CRPRCPTSMasterView" />
<INPUT TYPE="hidden" NAME="selected_index" VALUE="-1" /> <INPUT
        TYPE="hidden" NAME="MLDATA_CRPRCPTS_ITNBR" VALUE="" /> <!--Table-->
<TABLE border="1">
        <TBODY>
                <TR>
                        <TH>Select</TH>
                        <TH>Item</TH>
                        <TH>Forcasted Quantity</TH>
                </TR>
                <dab:repeat name="select_master" index="rowNum" over="rows">
                        <TR>
                                <TD><A
        
href="javascript:setSelectedIndex('<%=rowNum%>');submitForm('MLDATA_CRPRCPTSDeta
ilsView')">Details</A>
                                </TD>
                                <TD><dab:getColumn index="1" /> <INPUT
TYPE="hidden"
                                        NAME="MLDATA_CRPRCPTS_ITNBR<%=rowNum%>"
                                        VALUE='<dab:getColumn index="1"/>'
/></TD>
                                <TD><dab:getColumn index="2" /></TD>
                        </TR>

                </dab:repeat>
        </TBODY>
</TABLE>

</FORM>
</BODY>
</HTML>


Reply via email to