tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Cassidy <dcass...@hotgen.com>
Subject Re: JSP not returning full page problem
Date Fri, 22 Feb 2002 16:48:54 GMT
Ian,

On comment....
custom tags... Have a **big** read. they make jsp alot more readable.

is this visible on the net ? - ie can I see it in action ?

On which statement does the data finish ?
could you attach the output ?

Are there any exceptions generated in the tomcat logs ?

you might find rs.getString("column_name")  easier to read than  rs.getString(1)

It's a little more important when it's the data back from a view - where your DBA
can 'move' things around - as they want (bit me in the ass - view change not the DBA!)



Just a little one ...

   <td align="center" nowrap><select
STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt"
name="dayDateDay<%=checkBoxCount%>">
                                <OPTION <% if (day == 1){%>SELECTED <%}%> VALUE="01">01
                                <OPTION <% if (day == 2){%>SELECTED <%}%> VALUE="02">02
                                <OPTION <% if (day == 3){%>SELECTED <%}%> VALUE="03">03
                                <OPTION <% if (day == 4){%>SELECTED <%}%> VALUE="04">04

would be easier as ..

for (int a=1;a<32;a++)
    {
    if ( a==day )
        out.write("<OPTION SELECTED  VALUE=\"" + a +"\">" +a+"</OPTION>\n");
    else
          out.write("<OPTION  VALUE=\"" + a +"\">" +a+"</OPTION>\n");
     }

Although i'm sure there are faster ways :) - anyone ?

D



Ian Hilliard wrote:

> Thanks for the prompt reply,  here is the JSP that I am having problems
> with,
>
> as I say it is not returning any more than a certain amount of the page, if
> I decrease the amount of data per line the output becomes more but still
> hits the limit, I have a screen shot if it will make it clearer,
>
> <%@ page import="java.sql.*" %>
> <%! protected String driver="sun.jdbc.odbc.JdbcOdbcDriver";
> protected String url="jdbc:odbc:ian";
> protected String userid="system";
> protected String password="manager"; %>
>
> <%! public static String FIRST_QUERY =
>     "SELECT row_id, " +
>             "timesheet, " +
>             "emp_no, " +
>             "expense_date, " +
>             "customer_no, " +
>             "rechargeable, " +
>             "receipt_no, " +
>             "expense_type, " +
>             "expense_amount, " +
>             "foreign_exchange_rate_type, " +
>             "foreign_exchange_rate, " +
>             "actual_amount, " +
>             "vat, " +
>             "vat_rate_type, " +
>             "vat_rate, " +
>             "amount_vatable, " +
>             "amount_of_vat, " +
>             "oracle_work, " +
>             "mileage_from, " +
>             "mileage_to, " +
>             "mileage_rate_ee, " +
>             "mileage_rate_er, " +
>             "description " +
>     "FROM   expenses " +
>     "WHERE  emp_no=? and timesheet=? " +
>     "ORDER BY expense_date, customer_no, to_number(receipt_no)";
> %>
> <%! public static String SECOND_QUERY =
>     "SELECT customer_no, customer_description " +
>     "FROM   customer_no " +
>     "ORDER BY customer_no";
> %>
> <%! public static String THIRD_QUERY =
>     "SELECT expense_type " +
>     "FROM   expense_type " +
>     "ORDER BY expense_type";
> %>
> <%! public static String FORTH_QUERY =
>     "SELECT rate_type, rate_value " +
>     "FROM   foreign_exchange_rate " +
>     "ORDER BY rate_type";
> %>
> <%! public static String FIFTH_QUERY =
>     "SELECT vat_type, vat_rate_value " +
>     "FROM   vat_rate " +
>     "ORDER BY vat_type";
> %>
> <%
>     String empNo = (String) session.getAttribute("empNo");
>     String Timesheet = request.getParameter("Timesheet");
>     String _template = (String) session.getAttribute("_template");
>     String customerNo = "";
>     String customerDesc = "";
>     String expenseType = "";
>     String foreignExchangeRateType = "";
>     String foreignExchangeRateValue = "";
>     String vatType = "";
>     String vatRateValue = "";
>     String comment = "";
>     String mileageFrom = "";
>     String mileageTo = "";
> %>
> <%
>     PreparedStatement stmt;
>     ResultSet rs;
>     PreparedStatement stmt1;
>     ResultSet rs1;
>     PreparedStatement stmt2;
>     ResultSet rs2;
>     PreparedStatement stmt3;
>     ResultSet rs3;
>     PreparedStatement stmt4;
>     ResultSet rs4;
> %>
> <html>
> <head>
> <title>Symatrix Ltd.</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1\">
> <script language="JavaScript">
> </script>
> </head>
> <FORM name="ConfirmDeleteForm" method="POST"
> action="/symatrix/update_row_ex.jsp" target="mainFrame">
> <%
>     Class.forName(driver);
>     Connection conn = DriverManager.getConnection(url, userid, password);
>
>     stmt = conn.prepareStatement(FIRST_QUERY);
>     stmt.setString(1, empNo);
>     stmt.setString(2, Timesheet);
>
>     rs = stmt.executeQuery();
> %>
> <table width="%" border="0"
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt">
>   <tr bgcolor="#99CCCC">
>     <td align="center" nowrap>Update</td>
>     <td align="center" nowrap>Date</td>
>     <td align="center" nowrap>Customer</td>
>     <td align="center" nowrap>Rechargeable</td>
>     <td align="center" nowrap>Receipt No</td>
>     <td align="center" nowrap>Type</td>
>     <td align="center" nowrap>Net Amount</td>
>     <td align="center" nowrap>Exchange Rate</td>
>     <td align="center" nowrap>VAT</td>
>     <td align="center" nowrap>VAT Rate Type</td>
>     <td align="center" nowrap>VATable Amount</td>
>     <td align="center" nowrap>Oracle Work</td>
>     <td align="center" nowrap>Mileage From</td>
>     <td align="center" nowrap>Mileage To</td>
>     <td align="center" nowrap>Mileage Rate EE</td>
>     <td align="center" nowrap>Mileage Rate ER</td>
>     <td align="center" nowrap>Comment</td>
>   </tr>
>
> <%  String currentCustomerNo = "";
>     String currentExpenseType = "";
>     String currentForeignExchangeRateType = "";
>     String currentVatType = "";
>     String daydate = "";
>     int day = 0;
>     int month = 0;
>     int year = 0;
>     String rowColour = "#99CCCC";
>     int checkBoxCount = 1;
>
>     while (rs.next()) {
>         if (rowColour.equalsIgnoreCase("#99CCCC"))
>         {
>             rowColour = "#FFFFCC";
> %>
>             <tr bgcolor="#FFFFCC">
> <%      }
>         else
>         {
>             rowColour = "#99CCCC";
> %>
>             <tr bgcolor="#99CCCC">
> <%      }
>
> %>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" SIZE="1"
> TYPE="checkbox" name="SelectRow<%=checkBoxCount%>"
> value="<%=rs.getString(1)%>"></td>
>
> <%  daydate = rs.getString(4);
>     currentCustomerNo = rs.getString(5);
>     day = Integer.parseInt(daydate.substring(8,10));
>     month = Integer.parseInt(daydate.substring(6,7));
>     year = Integer.parseInt(daydate.substring(0,4));
> %>
>
>     <td align="center" nowrap><select
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt"
> name="dayDateDay<%=checkBoxCount%>">
>                                 <OPTION <% if (day == 1){%>SELECTED <%}%>
VALUE="01">01
>                                 <OPTION <% if (day == 2){%>SELECTED <%}%>
VALUE="02">02
>                                 <OPTION <% if (day == 3){%>SELECTED <%}%>
VALUE="03">03
>                                 <OPTION <% if (day == 4){%>SELECTED <%}%>
VALUE="04">04
>                                 <OPTION <% if (day == 5){%>SELECTED <%}%>
VALUE="05">05
>                                 <OPTION <% if (day == 6){%>SELECTED <%}%>
VALUE="06">06
>                                 <OPTION <% if (day == 7){%>SELECTED <%}%>
VALUE="07">07
>                                 <OPTION <% if (day == 8){%>SELECTED <%}%>
VALUE="08">08
>                                 <OPTION <% if (day == 9){%>SELECTED <%}%>
VALUE="09">09
>                                 <OPTION <% if (day == 10){%>SELECTED <%}%>
VALUE="10">10
>                                 <OPTION <% if (day == 11){%>SELECTED <%}%>
VALUE="11">11
>                                 <OPTION <% if (day == 12){%>SELECTED <%}%>
VALUE="12">12
>                                 <OPTION <% if (day == 13){%>SELECTED <%}%>
VALUE="13">13
>                                 <OPTION <% if (day == 14){%>SELECTED <%}%>
VALUE="14">14
>                                 <OPTION <% if (day == 15){%>SELECTED <%}%>
VALUE="15">15
>                                 <OPTION <% if (day == 16){%>SELECTED <%}%>
VALUE="16">16
>                                 <OPTION <% if (day == 17){%>SELECTED <%}%>
VALUE="17">17
>                                 <OPTION <% if (day == 18){%>SELECTED <%}%>
VALUE="18">18
>                                 <OPTION <% if (day == 19){%>SELECTED <%}%>
VALUE="19">19
>                                 <OPTION <% if (day == 20){%>SELECTED <%}%>
VALUE="20">20
>                                 <OPTION <% if (day == 21){%>SELECTED <%}%>
VALUE="21">21
>                                 <OPTION <% if (day == 22){%>SELECTED <%}%>
VALUE="22">22
>                                 <OPTION <% if (day == 23){%>SELECTED <%}%>
VALUE="23">23
>                                 <OPTION <% if (day == 24){%>SELECTED <%}%>
VALUE="24">24
>                                 <OPTION <% if (day == 25){%>SELECTED <%}%>
VALUE="25">25
>                                 <OPTION <% if (day == 26){%>SELECTED <%}%>
VALUE="26">26
>                                 <OPTION <% if (day == 27){%>SELECTED <%}%>
VALUE="27">27
>                                 <OPTION <% if (day == 28){%>SELECTED <%}%>
VALUE="28">28
>                                 <OPTION <% if (day == 29){%>SELECTED <%}%>
VALUE="29">29
>                                 <OPTION <% if (day == 30){%>SELECTED <%}%>
VALUE="30">30
>                                 <OPTION <% if (day == 31){%>SELECTED <%}%>
VALUE="31">31
>                         </select>
>     <select STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt"
> name="dayDateMonth<%=checkBoxCount%>">
>                                 <OPTION <% if (month == 1){%>SELECTED <%}%>
VALUE="JAN">January
>                                 <OPTION <% if (month == 2){%>SELECTED <%}%>
VALUE="FEB">February
>                                 <OPTION <% if (month == 3){%>SELECTED <%}%>
VALUE="MAR">March
>                                 <OPTION <% if (month == 4){%>SELECTED <%}%>
VALUE="APR">April
>                                 <OPTION <% if (month == 5){%>SELECTED <%}%>
VALUE="MAY">May
>                                 <OPTION <% if (month == 6){%>SELECTED <%}%>
VALUE="JUN">June
>                                 <OPTION <% if (month == 7){%>SELECTED <%}%>
VALUE="JUL">July
>                                 <OPTION <% if (month == 8){%>SELECTED <%}%>
VALUE="AUG">August
>                                 <OPTION <% if (month == 9){%>SELECTED <%}%>
VALUE="SEP">September
>                                 <OPTION <% if (month == 10){%>SELECTED <%}%>
VALUE="OCT">October
>                                 <OPTION <% if (month == 11){%>SELECTED <%}%>
VALUE="NOV">November
>                                 <OPTION <% if (month == 12){%>SELECTED <%}%>
VALUE="DEC">December
>                         </select>
>     <select STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt"
> name="dayDateYear<%=checkBoxCount%>">
>                                 <OPTION <%=year-1%> VALUE="<%=year-1%>"><%=year-1%>
>                                 <OPTION <%=year%> SELECTED VALUE="<%=year%>"><%=year%>
>                                 <OPTION <%=year+1%> VALUE="<%=year+1%>"><%=year+1%>
>                         </select></td>
>
>     <td align="center" nowrap><select
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt"
> name="customerNumber<%=checkBoxCount%>">
> <%
>     stmt1 = conn.prepareStatement(SECOND_QUERY);
>     rs1 = stmt1.executeQuery();
>
>     while (rs1.next())
>
>         customerNo = rs1.getString(1);
>         customerDesc = rs1.getString(2);
> %>
>     <OPTION <% if (customerNo.equalsIgnoreCase(currentCustomerNo))
> {%>SELECTED <%}%>VALUE="<%=customerNo%>"><%=customerNo%>-<%=customerDesc%>
> <%  }%>
>     </td>
>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" SIZE="1"
> TYPE="checkbox" NAME="rechargeable<%=checkBoxCount%>" VALUE="Y" <%if
> (rs.getString(6).equalsIgnoreCase("Y")) {%>CHECKED<%}%>></td>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" TYPE="text"
> NAME="receiptNo<%=checkBoxCount%>" value="<%=rs.getString(7)%>"></td>
>     <td align="center" nowrap><select
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt"
> name="expenseType<%=checkBoxCount%>">
>
> <%  currentExpenseType = rs.getString(8);
> %>
>
> <%
>     stmt2 = conn.prepareStatement(THIRD_QUERY);
>
>     rs2 = stmt2.executeQuery();
>
> %>
> <%                          while (rs2.next())
>
>                                 expenseType = rs2.getString(1);
> %>
>                             <OPTION <% if
> (expenseType.equalsIgnoreCase(currentExpenseType)) {%>SELECTED
> <%}%>VALUE="<%=expenseType%>"><%=expenseType%>
> <%                          }
> %>
>                         </select></td>
>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" TYPE="text"
> NAME="expenseAmount<%=checkBoxCount%>" value="<%=rs.getString(9)%>"></td>
>     <td align="center" nowrap><select
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt"
> name="foreignExchangeRateType<%=checkBoxCount%>">
>
> <%  currentForeignExchangeRateType = rs.getString(10);
> %>
>
> <%
>     stmt3 = conn.prepareStatement(FORTH_QUERY);
>
>     rs3 = stmt3.executeQuery();
>
> %>
> <%                          while (rs3.next())
>
>                                 foreignExchangeRateType = rs3.getString(1);
>                                 foreignExchangeRateValue = rs3.getString(2);
> %>
>                             <OPTION <% if
> (foreignExchangeRateType.equalsIgnoreCase(currentForeignExchangeRateType))
> {%>SELECTED
> <%}%>VALUE="<%=foreignExchangeRateType%>"><%=foreignExchangeRateType%>
-
> <%=foreignExchangeRateValue%>
> <%                          }
> %>
>                         </select></td>
>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" SIZE="1"
> TYPE="checkbox" NAME="vat<%=checkBoxCount%>" VALUE="Y" <%if
> (rs.getString(13).equalsIgnoreCase("Y")) {%>CHECKED<%}%>></td>
>     <td align="center" nowrap><select
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt"
> name="vatType<%=checkBoxCount%>">
>
> <%  currentVatType = rs.getString(14);
> %>
>
> <%
>     stmt4 = conn.prepareStatement(FIFTH_QUERY);
>
>     rs4 = stmt4.executeQuery();
>
> %>
> <%                          while (rs4.next())
>
>                                 vatType = rs4.getString(1);
>                                 vatRateValue = rs4.getString(2);
> %>
>                             <OPTION <% if (vatType.equalsIgnoreCase(currentVatType))
> {%>SELECTED <%}%>VALUE="<%=vatType%>"><%=vatType%> - <%=vatRateValue%>
> <%                          }
> %>
>                         </select></td>
>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" TYPE="text"
> NAME="vatableAmount<%=checkBoxCount%>" value="<%=rs.getString(16)%>"></td>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" SIZE="1"
> TYPE="checkbox" NAME="oracleWork<%=checkBoxCount%>" VALUE="Y" <%if
> (rs.getString(18).equalsIgnoreCase("Y")) {%>CHECKED<%}%>></td>
>
> <%  mileageFrom = rs.getString(19);
>     mileageTo = rs.getString(20);
>
>     if (mileageFrom == null)
>     {
>         mileageFrom = " ";
>     }
>     if (mileageTo == null)
>     {
>         mileageTo = " ";
>     }
> %>
>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" TYPE="text"
> NAME="mileageFrom<%=checkBoxCount%>" value="<%=mileageFrom%>"></td>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" TYPE="text"
> NAME="mileageTo<%=checkBoxCount%>" value="<%=mileageTo%>"></td>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" TYPE="text"
> NAME="mileageRateEE<%=checkBoxCount%>" value="<%=rs.getString(21)%>"></td>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" TYPE="text"
> NAME="mileageRateER<%=checkBoxCount%>" value="<%=rs.getString(22)%>"></td>
>
> <%  comment = rs.getString(23);
>
>     if (comment == null)
>     {
>         comment = " ";
>     }
> %>
>     <td align="center" nowrap><INPUT
> STYLE="font-family:Verdana,Helvetica,Arial;font-size:7pt" TYPE="text"
> NAME="comment<%=checkBoxCount%>" value="<%=comment%>"></td>
>   </tr>
> <%
>         checkBoxCount = checkBoxCount + 1;
>     }
> %>
>
> </table>
> <INPUT VALUE="Confirm Update" STYLE="color:#ffffff;
> font-family:Verdana,Helvetica,Arial;font-size:7pt; font-weight:normal;
> background:#3E92B7;cursor:hand" TYPE="submit"></td>
> <INPUT NAME="checkBoxTotal" TYPE="hidden" VALUE="<%=checkBoxCount-1%>">
> </html>
>
> Ian Hilliard
> ian.hilliard@symatrix.co.uk
>
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message