This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a little question about outputting data

 
Sim Raina
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a servlet that connects to sql database and gets the info and then i print it to the browser the only problem is that when it prints it takes a long time to print like 3 to 4 minutes may be because there are too many records or may be i am outputting the data in a table. So i want the table to display the every field one by one instead of displaying it all together. thank you guys in advance.
i heard of this method called flush but i don know what that is
 
shankar vembu
Ranch Hand
Posts: 309
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean to say that it is taking 3-4 mins to render the page or does the server side process takes 3-4 mins???
Regarding flush, I think you want something like HTTP streaming. Well, simply flushing the stream while keeping the connection open, I think is browser dependent. It did not work in my browser(IE 5) when I tried it and you should not use this concept. If there are too many records, then one way is to display the records in batches of say 15 records per page and then let the user request for the next set of records.
Regards.
 
Sim Raina
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i want it to do is display the each row one by one like we see in sql. cuz that is how my work wants and it also occured to me to use the batches but they don't want it that way. so any other suggestions???

this si what i m doing
while(rs.next())
{
count++;
String ipaddress = GetRSVal( rs, "ipaddress" );
String username = GetRSVal( rs, "usrnme",Blank ) ;
String domain = GetRSVal( rs, "domain" );
String date = GetRSVal( rs, "t_date" );
String time =GetRSVal( rs, "t_time" );
String req = GetRSVal( rs, "REQUESTTYPE" );
prn.print( "<TR>" );
prn.print("<TD><p align=\"center\">" + ipaddress + "</TD>" );
prn.print("<TD><p align=\"center\">" + username + "</TD>" );
prn.print("<TD><p align=\"center\">" + domain + "</TD>" );
prn.print("<TD><p align=\"center\">" + date + "</TD>" );
prn.print("<TD><p align=\"center\">" + time + "</TD>" );
prn.print("<TD><p align=\"center\">" + req + "</TD>" );
prn.print("<TD><p align=\"center\"><A HREF=\"/WebLogs/Details?domain=" + domain + "&url=" + GetRSVal( rs, "int_url","" ) + "&usrnme=" + username +"&date=" + date+ "&time=" + time + "\"> Description </TD>" );
prn.print("<TD><p align=\"center\"><A HREF=\"" + domain + GetRSVal( rs, "f_file" ) + GetRSVal( rs, "p_parameters" )+ "\"> LINK </TD>" );
prn.println( "</TR>" );
}
 
steve souza
Ranch Hand
Posts: 862
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For an easier way to generate html tables check out the FormattedDataSet. Out of the box it can generate an html table in 2 lines of code including the constructor.
 
steve souza
Ranch Hand
Posts: 862
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just added a live demo page that allows you to type in a query and have the results returned as an HTML table with Sortable/clickable column headers. You can just hit submit when the default query comes up or you can enter your own query.
The demo is at http://www.ssouza.com/fdsapi/sortdemo.jsp
steve - http://www.fdsapi.com - the easiest way to generate dynamic xml and html.
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think one of your main problems is that browsers usually wait until the end of a table before displaying it, so even if you were to flush each row before moving to the next one, you still wouldn't see the table until it was complete.
To solve this you could try sending each row of the table as a whole table. To ensure that the columns match, you will need to set explicit widths for the columns, though. Try something like:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic