Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Resultset too big for send to clients


Message #1 by PeterMiller <p.miller@b...> on Mon, 14 Oct 2002 11:23:23 +0200
Hi Greg,

thank you for the explanation.
Peter

Greg Dunn schrieb:

>The trim() method for the resultSet field String object trims off any
>extraneous leading and trailing spaces.  Usually that's not a big issue with
>a 'Varchar' field but it never hurts.  (A 'Char' field, on the other hand,
>fills in trailing spaces to reach it's designated size, so you should always
>trim them.)  HTML won't display the spaces but they add to the volume of
>data.
>
>This also builds one long string for the select element, which eliminated a
>lot of returns in the text.  Again, HTML doesn't care about whitespace so it
>displays the same, and you probably don't care how legible the HTML is in a
>generated page.
>
>Greg
>
>
>
>-----Original Message-----
>From: PeterMiller [mailto:p.miller@b...]
>Sent: Tuesday, October 15, 2002 4:58 AM
>To: Pro_JavaServer_Pages
>Subject: [pro_jsp] RE: Resultset too big for send to clients
>
>
>Hi Greg,
>
>super tip!!!
>I test it and the network  traffic decreased 37% !!
>Before I changed my query so I got down from 600kB to 300kB and then
>with your hint there are 'only' 190kB left.
>That's a big amount for a internet app but with the new capabilities
>(DSL, Cable, ...)I'm optimistic that our customers will be
>satisfied with this solution.
>If anyone have one more idea please tell me.
>
>But so far, many many thanks to you  Greg (btw, can you explain to me
>why the data size get smaller when I do like this?)!!
>
>Peter
>
>
>Greg Dunn schrieb:
>
>  
>
>>The best way to reduce the size of your resultset is to narrow your search.
>>If you can't, then the JSP might load faster if you build the whole select
>>box first (with some tweaks) and then put it into the HTML:
>>
>><%
>>String strOption = "";
>>String strSelect = "<SELECT NAME=\"stichwort1\">";
>>strSelect = strSelect + "<OPTION SELECTED VALUE=\" \"></OPTION>";
>>
>>rst2.absolute(1);
>>
>>while(rst2.next())  {
>> strOption = rst2.getString(1).trim();
>> strSelect = strSelect + "<OPTION VALUE=\"" + strOption +
>>   "\">" + strOption + "</OPTION>";
>>}
>>
>>strSelect = strSelect + "</SELECT>";
>>%>
>>
>><TR>
>> <TD>&#160;</TD>
>> <TD ALIGN="LEFT">
>>   <STRONG>Stichwort1:</STRONG><BR>
>>     <%= strSelect %>
>>   <BR>&#160;
>> </TD>
>></TR>
>>
>>
>>Greg
>>
>>
>>
>>-----Original Message-----
>>From: PeterMiller [mailto:p.miller@b...]
>>Sent: Monday, October 14, 2002 4:23 AM
>>To: Pro_JavaServer_Pages
>>Subject: [pro_jsp] Resultset too big for send to clients
>>
>>
>>Hi all,
>>
>>I have a big problem:
>>I look for my options in a databasetable (see code ex.). I have 2 of
>>these select-statements.
>>each resultset has nearly 4000 rows, and the table has only this one
>>field (varchar(25)).
>>When I check the traffic its about 600KBytes until the page shows up.
>>The table itself has only a size of 180KBytes.
>>
>>What can I do to reduce the size of my resultset??????
>>It#s a very big prob, because nobody want to wait 1 minute for a page!
>>PLEASE HELP ME!!!
>>
>><TR>
>>   <TD>&#160;</TD>
>>   <TD ALIGN="LEFT">
>>       <STRONG>Stichwort1:</STRONG><BR>
>>       <SELECT NAME="stichwort1">
>>       <OPTION SELECTED VALUE="">
>>
>>       </OPTION>
>>       <%
>>       rst2.absolute(1);
>>       while(rst2.next())  {
>>       %>
>>       <OPTION VALUE="<%=rst2.getString(1)%>">
>>       <%=rst2.getString(1)%>
>>       </OPTION>
>>       <% } %>
>>       </SELECT>
>>       <BR>&#160;
>>   </TD>
>></TR>
>>
>>I would be very thankful for every hints you can give me!°
>>
>>Best regards,
>>Peter
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>    
>>
>
>
>
>
>
>
>
>
>
>  
>



  Return to Index