Results 1 to 2 of 2
  1. #1
    kev_thomas is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Unhappy Oracle/JSTL - All data not being retrieved/displayed

    First off...apologies from a newb if I'm posting this in the wrong area...please tell me where to go (politely) and I'll post there :D

    I have a JSP page which is using JSTL tags to retrieve data from an Oracle database and it's giving me some weird formatting issues which I can't seem to get resolved. I've been following most of the examples on how to format data in a table, but for some reason all my columns/data are not being displayed correctly.

    My query looks like this:

    Java Code:
    <sql:query var="idata">
          SELECT batch_date        "Batch Date"
                     ,produced_vol    "MPRS Produced"
                     ,processed_vol   "MPRS Processed"
                     ,online_vol         "MPRS Online"
                     ,TO_CHAR(ecoes_date,'DD-MON-YYYY HH24:MI:SS') "ECOES Complete"
            FROM mprs_instr_counts
           WHERE batch_date >= SYSDATE -7
             AND mpid = 'SPOW'
           ORDER BY batch_date DESC
     </sql:query>

    The actual presentation section looks like this:

    Java Code:
    <table>
      <%-- Get the column names for the header of the table --%>
      <c:forEach var="columnName" items="${idata.columnNames}">
        <th><c:out value="${columnName}"/></th>
      </c:forEach>
    
      <%-- Get the value of each column while iterating over rows --%>
      <c:forEach var="row" items="${idata.rows}">
        <tr>
        <c:forEach var="column" items="${row}">
          <td><c:out value="${column.value}"/></td>
        </c:forEach>
      </tr>
      </c:forEach>
    </table>
    The output appears like this:


    Java Code:
    <blank column header>     Batch Date   MPRS Produced   <blank>    <blank>
    07-OCT-2009 19:50:36      30598          16171              <blank>    <blank>
    06-OCT-2009 22:55:31      44359          27871 
    06-OCT-2009 00:28:07      75433          53256 
    02-OCT-2009 22:23:47      45129          29073
    As you may be able to see, the code is recognising that there are 5 columns worth of data to output, but it's getting the data mixed up with the headers, and missing headers and some data out alltogether.

    The first column should be called BATCH_DATE, and as can be seen, the date *is* in the first column, but the actual header is blank and then the BATCH_DATE header appears in the *second* column with the wrong data!

    It's driving me nuts...any suggestions anyone would be very much appreciated!

    Cheers,
    Kev.

  2. #2
    kev_thomas is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default

    Apologies for the multi-post...my browser kept timing out and it looked as though the post never made it through :(

Similar Threads

  1. how to display data from oracle database?
    By deru4jesus in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 04-16-2009, 08:46 AM
  2. Replies: 1
    Last Post: 09-15-2008, 08:21 PM
  3. Replies: 3
    Last Post: 08-05-2008, 03:19 AM
  4. Problem is getting the data to browser(JSTL)
    By freddieMaize in forum JavaServer Pages (JSP) and JSTL
    Replies: 6
    Last Post: 07-15-2008, 03:04 PM
  5. Replies: 4
    Last Post: 08-09-2007, 10:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •