How to generate dummy rows in jsp??

Hi,
I have 2 records in my DB while iam displaying the page i should generate six rows, in that first twos should contain those 2 records from DB (this i had done) and the next four rows should be empty. I am using JSP and SERVLET i need to generate dummy rows in jsp. How could i do it.
Thanks in advance.

@hunter9000
yes but rows will be generated dynamically. so it wont be helpful.
@quitte
did not get you. kindly go through my code. here am using ajax for getting refreshed for every 10 seconds.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/theme/common.css" />
<TITLE>DepartureInfo.jsp</TITLE>
</HEAD>
<script type="text/javascript">
var dummy=0;
function loadDepartureList() {          
     dummy++;
     if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    req.onreadystatechange = getDepartureList;          
     url="./departurescreen?action=depart&dummy="+dummy;          
    req.open("GET", url, true);
    req.send(null);
function getDepartureList() {
   if (req.readyState == 4)
       if (req.status == 200)
               html = req.responseText;                                        
               document.getElementById('deptdata').innerHTML = html;               
          else
           alert('There was a problem with the request.'+req.readyState+","+req.status);
</script>
<%@page import="com.rak.uiobjects.response.FlightInfoResponseObject,java.util.*" %>
<jsp:useBean id="displayList" scope="request" class="java.util.ArrayList"></jsp:useBean>
<BODY topmargin="0" leftmargin="0">
<!--<%
        String language;
        String country;
            language = new String("en");
            country = new String("US");
        Locale currentLocale;
        ResourceBundle messages;
        currentLocale = new Locale(language, country);
        messages = ResourceBundle.getBundle("MessagesBundle",
                                           currentLocale);
        System.out.println(messages.getString("farewell"));
          String Greet = messages.getString("farewell");   
%>
--><table border="0" height="1411" width="2509" cellspacing="0" cellpadding="0">
<tr>
<td height="80%" valign="top">
     <table border="0"  width="100%">
            <tr > 
                   <td width="100%" colspan="8" height="7%" class="mainheader">Departure</td>
            </tr>
      </table>
<div id="deptdata">
  <table border="0" cellspacing="0" height="86%" width="100%">
  <tr valign="top">
    <td class="subheader" height="7%">Flight No</td>
    <td class="subheader">Airline</td>
    <td class="subheader">Time</td>
    <td class="subheader">Destination</td>
    <td class="subheader">Flying Time</td>
    <td class="subheader">Status</td>
    <td class="subheader">ETD</td>
    <td class="subheader">Gate</td>
  </tr> 
<%if(displayList.size() == 0) {%> 
  <tr >
  <td class="rowdatahighlight" height="66%" colspan="8">List is Empty</td>
  </tr> 
  <%}else{
String clazz="";
int record=1;
Iterator i = displayList.iterator();
while(i.hasNext()){
FlightInfoResponseObject flightInfoResponseObjects = (FlightInfoResponseObject)i.next();
if(record%2==0){
clazz="rowdata";
}else{ 
clazz="rowdatahighlight";
System.out.println("SIZE IS::"+displayList.size());
%>
  <tr class="<%=clazz %>">
     <td  height="11%"><%=flightInfoResponseObjects.getFlightNo() %></td>
    <td ><%=flightInfoResponseObjects.getAirLine()%></td>
    <td ><%=flightInfoResponseObjects.getDeptTime() %></td>
    <td ><%=flightInfoResponseObjects.getToDestination() %></td>
    <td ><%=flightInfoResponseObjects.getFlyingTime()%></td>
    <td ><%=flightInfoResponseObjects.getStatus() %></td>
    <td ><%=flightInfoResponseObjects.getEtdOrA() %></td>
    <td ><%=flightInfoResponseObjects.getGate()%></td>
  </tr>
<% record = record +1;} }%>
  </table>
  </div>
</td>  
</tr>
<tr>
<td height="20%" valign="top">
  <div id="deptbanner">
  <table border="0" height="100%" width="100%"> 
      <tr>
         <td width="100%" colspan="8" class="mainheader"> </td>
      </tr>
   </table>
   </div>
</td>
</tr>
</table>
<SCRIPT LANGUAGE="JavaScript">
window.setInterval("loadDepartureList()",10000);
</SCRIPT>
</BODY>
</HTML>

Similar Messages

  • How to generate synthetic rows (raw(16) guid cols) in one SQL statement?

    We're populating a table containing two GUID columns:
    create table object
    ( object_guid raw(16) primary key
    , project_guid raw(16)
    )All object GUIDs are unique (thus the PK), and each object belongs to a given project (should be a FK to some project table). We want N objects / rows, belonging to only 100 projects, i.e. 1% of the rows of the object table belong to the project #1, 1% to #2, etc...
    Right now we're using about 25 lines of C++/OCI code to do that (one query doing a "select sys_guid() from dual", and using the generated GUIDs to do inserts into object), but I suspect it's possible to do this using a single SQL statement using mysterious connect by or some other Oracle SQL magic. (our OCI code does quite a few round-trips to do the equivalent).
    Would anyone please demonstrate how to generate the rows as explained above, and possibly describe how it works for the non-initiated?
    Thanks, --DD
    PS: I'm sure it can be done in PL/SQL as well, but I'm interested in a SQL version if one's possible.

    I've found two ways, both taking a few SQL statements, but somehow I think this ought to be possible without intermediary tables... I'm sure there's a better way.
    #1drop   table project_tmp;
    create table project_tmp
    as select rownum pid, sys_guid() guid from dual
    connect by level <= 100;
    drop   table object_tmp;
    create table object_tmp
    as select mod(rownum, 100) + 1 pid, sys_guid() guid from dual
    connect by level <= 1000;
    drop   table object;
    create table object
    as select o.guid object_guid, p.guid project_guid
    from object_tmp o, project_tmp p
    where o.pid = p.pid;
    drop table project_tmp;
    drop table object_tmp;#2:drop table project;
    create table project
    as select mod(rownum, 100) + 1 prj_id, sys_guid() guid from dual
    connect by level <= 100;
    drop table object;
    create table object
    as select mod(rownum, 100) + 1 prj_id, sys_guid() object_guid from dual
    connect by level <= 1000;
    alter table object add project_guid raw(16);
    update object o set o.project_guid = (select guid from project p where p.prj_id = o.prj_id);
    drop table project;
    alter table object drop column prj_id;Verification:select count(distinct project_guid) from object;
    select project_guid, count(OBJECT_GUID) from object group by project_guid;

  • How to generate a row in report to compute total?

    Hi:
    I need help to generate a report. In an accounting report, I need to make sum for each client regarding outstanding balance. The format of report is following:
    invoice#, invoice date, invoice amount, paid amount paid date, write off, outstanding balance
    Client Name: Baker Express / Debtor Name: Kurt Weiss inc.
    137308001, 04/18/2012, 438.07, 537.07, 06/05/2012, , (99)
    137308002, 04/18/2012, 100, 90, 06/05/2012, 10,
    client Total: total payment:627.07, total outstanding balance: (99)
    another client and debtor pair
    My question is how to generate total payment and total outstanding balancefor every pair of client and debtor. And there are multiple pairs. I tried to use group by, but how can I display every invoice tuple as well in the report?
    Any help would be appreciated.
    Sam

    One method would be to use ROLLUP in your SQL
    http://www.oracle-base.com/articles/misc/rollup-cube-grouping-functions-and-grouping-sets.php

  • How to generate Word document from JSP ?

    Hi,
    I want to generate Word documnet from JSP. I am using Neva objects to generate Word document. Now my problem is Word doc generation code works alright as a Java application but when I place that piece of code in a JSP bean it throws an exception. The reason seems to be unavailibility of DLLs and other files of Neva in Tomcat environment. I do not want to use other complex packages like JIntegra, I would prefer any freeware solution. There is not much info. about Word document generation on POI project in Jakarta site.
    Could anyone suggest way out ? Any Java examples doing the same would be of great help.
    Thanks,
    Akash

    Hi Saurabh,
    Thanks for the reply.
    I have tried that too. Problem with that solution is that if you have used CSS in your JSP code MS word does not understand it and generates word doc which is not the same as HTML which JSP otherwise would have generated.
    Akash

  • How to generate a file from JSP form

    Hi,
    I want to generate a file from the informations of a form(JSP).
    Which classes do I have to use ?
    Thanks.

    Of course you have to use the standard servlet classes to retrieve the request parameters from the form.
    ie request.getParameter();
    package "java.io" gives you File input/output ability.
    If you are generating a text file, thats probably the BufferedWriter and FileWriter classes.
    Cheers,
    evnafets

  • How to generate automatically a html/jsp page in my tomcat web container?

    I would like to generate a personal web-page for every user after registration.
    Have any sample code for me?

    I want to send all details entered in Registration Form directly to an E-Mail address and not to a database. I also don't want to open Outlook Express.

  • How to generate the submenu with JSP??

    I want to show a submenu when the mouse pointer upon a specific link or area. can i do that with JSP?

    I agree with whizkeys, you cannot do that with javacode in a JSP, you will need to use javascript (unless you want to try it with an applet, but, then you would have other issues and it would be a pain in the balls).

  • How to generate a row value automatically...(row count)

    Hi,
    I have a Table in my application with fields like
    ID     CNAME
    i should generate the values for the ID field dynamically with a Prefix..also this ID field is not visible to users, its for the database update alone...
    Thanx.
    Arjun.G

    Hi,
    Make this Id attribute calculated.
    When you make an attribute calculated you will be able to see the getter method created for the attribute
    In side the getter you can generate the value you needed.
    For Ex.
    public java.lang.String getID(IPrivateTestCompView.IContextElement element)
        //@@begin getID
        return UUID.randomUUID().toString() ;
        //@@end
    Regards
    Ayyapparaj

  • How to read all rows stored in pojo bean from jsp page

    Hi sir
    After storing all rows into ArrayList object in pojo class, how to retrieve those rows from jsp page and display them together one by one.
    Regards

    Well, you wouldn't do it in Java. You would do it in JSTL, preferably.
    So if your POJO had a getRows method which returned your List of row objects, you would get the list like this (after putting the POJO into request scope under the name of "pojo"):
    ${pojo.rows}
    And if you wanted to go through that list and process each of the rows, then c:forEach would be the way:
    <c:forEach value="row" items="${pojo.rows} />
    (check the documentation, I'm posting this from memory)

  • Generate Jasper report in JSP

    Hi all,
    im currently doing some research on jasper. Im totally new to this and wish if somebody can give some tips on how to start off..Below are some of my questions..
    1. After compile and create the report design using iReport, does it means when we've got our XML response from server ,we just feed in the fields accordingly to the .jasper file we've created earlier on OR we have to concurrently design,and compile report and send XML request to server...
    2. Can provide me with some ideas of how to generate jasper report in JSP where the whole process is inclusive of passing XML request to server..retrieving data..formatting..passing result set to XML response ...may i know when is the process of generating jasper start off in between of this?
    Please advise, im really blurred at the moment...
    Thx a million...
    chEers,
    cyunntan

    Probably it�s better to ask it at JasperReports Forums:
    http://sourceforge.net/forum/?group_id=36382

  • Generating multiple rows from one physical row

    I was wondering if anyone has done or knows how to generate multiple rows for one physical row. In my query "SELECT Cust_No, Amount from Balances" if the amount is > 99,999.99 I want 2 rows returned, one with an amount of 90,000.00 and the other with an amount of 9,999.99. I'm thinking I need to use a view or function to return a result set but I'm not sure how.
    Thanks in advance,
    Allen Davis
    [email protected]

    James,
    Well your right in that you need a function, but also 3 views to accomplish that. I just wrote up the sql below and tested it. Basically you want the first view to return all records less than your cap of 99,999, thoes that exceed that will always return as 90,000 (see example on record PK 774177177). The second view returns money that remains AFTER the cap (in your case 9,999). The second view though also has to excude the ones less than the CAP.
    DATA and TABLE layout
    1) Table is called T1, columns are PK : primary key value, and N2 : some number column holding the MONEY amount
    2) data is below fromtable called t1 (10 records) ...
    select pk,n2 from t1 order by pk
    PK     N2
    117165529     100
    274000876     200000
    350682010     9999
    737652242     90000
    774177177     99999
    1369893126     1000
    1663704428     100000
    1720465556     8888
    1793125955     0
    1972069382     1000000
    Now see the records with money at 99,999 (just like in your example). You want 2 records, so the VIEWS now come into play. The view itself CALLS the function, this occurs when you select from the view. The function will either return 90,000 (your defined cap) or the remained after subtracting the money from 90,000. The 3 views are defined below (the FUNCTION which is shown after will have to be compiled first) ...
    --[VIEWS START]
    CREATE OR REPLACE VIEW VIEW1
    (PK,SHOW_MONEY)
    AS SELECT PK,FN_TRIM_MONEY(N2,1) FROM T1;
    CREATE OR REPLACE VIEW VIEW2
    (PK,SHOW_MONEY)
    AS SELECT PK,FN_TRIM_MONEY(N2,2) FROM T1 WHERE N2 >= 99999;
    CREATE OR REPLACE VIEW VIEW_ALL
    (PK,SHOW_MONEY)
    AS
    SELECT * FROM VIEW1
    UNION ALL
    SELECT * FROM VIEW2;
    --[VIEWS END]
    OK now for the actual function ...
    --[FUNCTION START]
    CREATE OR REPLACE FUNCTION
    FN_TRIM_MONEY
    PI_MONEY NUMBER,
    PI_VIEW_ID NUMBER
    RETURN NUMBER AS
    LS_TEMP VARCHAR2(2000);
    LI_TEMP NUMBER;
    LD_TEMP DATE;
    LI_CON_MONEY_MAX CONSTANT NUMBER := 90000;
    LS_RETURN VARCHAR2(2000);
    BEGIN
    IF (PI_MONEY > LI_CON_MONEY_MAX) THEN
    IF PI_VIEW_ID = 1 THEN
    LI_TEMP := LI_CON_MONEY_MAX;
    ELSIF PI_VIEW_ID = 2 THEN
    LI_TEMP := (PI_MONEY - LI_CON_MONEY_MAX);
    END IF;
    ELSE
    LI_TEMP := PI_MONEY;
    END IF;
    IF LI_TEMP < 0 THEN
    LI_TEMP := 0;
    END IF;
    LS_RETURN := LI_TEMP;
    RETURN LS_RETURN;
    END;
    SHOW ERRORS;
    --[FUNCTION END]
    I compiled the function and views with no errors. This is what I get when I query the 3 views ...
    --[VIEW 1]
    PK     SHOW_MONEY
    117165529     100
    274000876     90000
    350682010     9999
    737652242     90000
    774177177     90000
    1369893126     1000
    1663704428     90000
    1720465556     8888
    1793125955     0
    1972069382     90000
    --[VIEW 2]
    PK     SHOW_MONEY
    274000876     110000
    774177177     9999
    1663704428     10000
    1972069382     910000
    --[VIEW ALL]
    PK     SHOW_MONEY
    117165529     100
    274000876     90000
    274000876     110000
    350682010     9999
    737652242     90000
    774177177     90000
    774177177     9999
    1369893126     1000
    1663704428     90000
    1663704428     10000
    1720465556     8888
    1793125955     0
    1972069382     90000
    1972069382     910000
    So notice the PK entry 774177177 listed twice, once with 90,000 and other with 9,999. Also notice we now have 14 records from the original 10, meaning 4 records qualified for the split (all data from VIEW 2).
    This is why Oracle kicks ass, views and functions are very powerful when used together and can return pretty much anything.
    Thanks,
    Tyler D.
    [email protected]

  • How To Generate Debug Log Files for ebs jsp?

    hi   How To Generate Debug Log Files for ebs r12 jsp?
    and where i get the log .please help me thanks!

    Please check following MOS Document
    Oracle Application Server Diagnostic Tools and Log Files in Applications Release 12 (Doc ID 454178.1)

  • How we can generate dynamic menu in jsp page

    Hi all,
    how we can generate dynamic menu in jsp page.
    Thanks
    Manjinder

    by reading more about them on the web or in a good book, OR BY HIRING SOMEBODY TO DO SO. ;)

  • How to generate rows in SQLPLUS ?

    Hi,
    Suppose, I have data like this in Oracle 9.2
    200, 74001, 74010, 1, 3, 4
    I want output like this
    200,74001,1
    200,74001,3
    200,74001,4
    200,74002,1
    200,74002,3
    200,74002,4
    200,74010,1
    200,74010,3,
    200,74010,4
    How can I generate these rows in SQLPLUS ? Can it be possible using connect by ?
    thanks & regards
    parag

    And a version which don't supresses the »74010« row (but assumes 10g):
    SQL>  with t as
      select 200 col1, 74001 col2, 74010 col3, 1 col4, 3 col5, 4 col6 from dual
    select * from xmltable('for $i in ROWSET/ROW for $j in xs:integer($i/COL2/text()) to xs:integer($i/COL3/text())
                                return for $k in 1 to 3
                                        return <r><i>{$i/COL1/text()}</i><j>{$j}</j><k>{$i/*[$k+3]/text()}</k></r>'
                             passing xmltype(cursor(select * from t))
                             columns col1 integer path 'i',
                                     col2 integer path 'j',
                                     col3 integer path 'k')
          COL1       COL2       COL3
           200      74001          1
           200      74001          3
           200      74001          4
           200      74002          1
           200      74002          3
           200      74002          4
           200      74003          1
           200      74003          3
           200      74003          4
           200      74004          1
           200      74004          3
           200      74004          4
           200      74005          1
           200      74005          3
           200      74005          4
           200      74006          1
           200      74006          3
           200      74006          4
           200      74007          1
           200      74007          3
           200      74007          4
           200      74008          1
           200      74008          3
           200      74008          4
           200      74009          1
           200      74009          3
           200      74009          4
           200      74010          1
           200      74010          3
           200      74010          4
    30 rows selected.

  • How to add a dummy row in the result set of a SELECT statement.

    Hello Everyone -
    I have requirment to add a dummy row in the result set of a SELECT statement.
    For e.g. lets say there is a table Payment having following colums:
    Payment_id number
    status varchar2(10)
    amount number
    payment_date date
    so here is the data :-
    Payment_id Status Amount payment_date
    1 Applied 100 12/07/2008
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    Here is my SQL
    Select * form payment where payment_date >= 01/01/2009
    Output will be
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    My desired output is below
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    2 Reversed -200 01/ 06/2009 ------(Dummy Row)
    Thrid row here is the dummy row which I want to add when status is "Reversed"
    I would be very thankful for any kind of help in this regard ...
    Thanks,
    Gaurav

    Cartesion joining against a dummy table is a useful method of creating a dummy row:
    with my_tab as (select 1 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
                    select 1 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 1 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/05/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 4 Payment_id, 'Reversed' Status, -400 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 5 Payment_id, 'Applied' Status, 500 Amount, to_date('01/07/2009', 'mm/dd/yyyy') payment_date from dual),
                    --- end of mimicking your table
          dummy as (select 'Reversed' col1, 1 rn from dual union all
                    select 'Reversed' col1, 2 rn from dual)
    select mt.cust_id,
           mt.payment_id,
           mt.status,
           decode(dummy.rn, 2, -1*mt.amount, mt.amount) amount,
           mt.payment_date
    from   my_tab mt,
           dummy
    where  mt.status = dummy.col1 (+)
    order by mt.cust_id, mt.payment_id, dummy.rn nulls first;
    CUST_ID     PAYMENT_ID     STATUS     AMOUNT     PAYMENT_DATE
    1     1     Applied     100     07/12/2008
    1     2     Reversed     200     06/01/2009
    1     2     Reversed     -200     06/01/2009
    1     3     Applied     300     06/01/2009
    2     1     Applied     100     07/12/2008
    2     2     Reversed     200     05/01/2009
    2     2     Reversed     -200     05/01/2009
    2     3     Applied     300     06/01/2009
    2     4     Reversed     -400     06/01/2009
    2     4     Reversed     400     06/01/2009
    2     5     Applied     500     07/01/2009Edited by: Boneist on 07-Jan-2009 23:10
    NB. You may have to mess around with the ordering if that's not come back in the order you wanted. You didn't mention what the rules were for any expected ordering though, so I've made up my own *{;-)
    Also, I added an identifier (cust_id) to differentiate between different sets of payments, since that's usually the case. Remove that if it's not applicable for your case.

Maybe you are looking for

  • HT1296 How to back up iphone to computer

    I've never connected my iphone to a computer. How can I back it up to a computer? With out deleting everything from it. I connected to the computer and it tells me I can only start it as new iphone ? Help please

  • Error while Deploying composite using Jdeveloper

    Hi , I made app server connection and tested the configuration. All the tests ran succesfully. However when I try to deploy my SOA project on server , I am not able to look up soa server . Server is on different machine and connected using wifi-route

  • OPEN DATASET......FOR APPENDING

    Hello ppl, I found the following help for OPEN DATASET in APPENDING mode: If the file already exists, its contents are retained, and the system moves to the end of the file. If the file does not exist, the system creates it. If the file was already o

  • SQL Loader and table views

    I am having a problem updating a large partitioned table through it's appropriate view. Here is the loader file LOAD DATA                INSERT INTO TABLE test.example                     (      PROGRAM POSITION(1:4) CHAR,           DWING_NUMBER     

  • 2.0.1 Major Problems

    We just upgraded to DVDSP4 and Compressor 2.0.1 with it. I export a DV Quicktime from Avid and try to convert it to an m2v in Compressor. Certain presets hard crash the entire system (as in a full freeze up) and I must restart. Others (seems to be si