The Artima Developer Community
Sponsored Link

Web Services Forum
Records In JSp & backend Differ ??

1 reply on 1 page. Most recent reply: Nov 18, 2003 1:28 AM by Viswanatha Basavalingappa

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Birendar S Waldiya

Posts: 21
Nickname: ebiren
Registered: Nov, 2003

Records In JSp & backend Differ ?? Posted: Nov 5, 2003 11:03 PM
Reply to this message Reply
Advertisement
Hi,
I have a strange problem. Im executing a database query that returns 1 record in jsp( using ResultSet.next()) where as when i execute same query in backend i get two recods .can anyone tell me why??
thaks
rgds
Birendar S Waldiya


the jsp code that process the query is :-
<code>

while(fetchRS.next())
{

if(subTotalReq && !firstLoop && !tempValue.equals(fetchRS.getString(1))){
tempParam = " and " + Columns.get(0).toString() + "$'" + tempValue+"'";
tempHeader = Headings.get(0).toString() + ":" + tempValue;

out.println("<tr>");
out.println("<td class=\"TrtblS_la\" style=\"background-color:silver\" colspan=\"2\"><b>SUB Total For "+tempValue+"</b></td>");
out.println("<td class=\"TrtblC_ra\" style=\"background-color:silver\" colspan=\""+(columnsCount-2)+"\"><a class=\"DLnk\" href=\""+calledPage+"?parameters="+tempParam.replace('&','^').replace('+',' |'). replace('%','~')+"&headers="+tempHeader.replace('&','^').replace('+','| ')+"&cond ition="+condition.toString().replace('%','~').replace('&','^').replace('+', '|')+ "&searchBy="+searchBy+"&exp_from_date="+exp_from_date+"&exp_to_date ="+exp_to_dat e+"&from_month="+from_month+"&to_month="+to_month+"\"><strong> "+formatt er.format(subTotal)+"</strong></a></td>");

out.println("< /tr>");
pageContent.append("\n");
pageContent.append("Sub Total For "+tempValue+"\t"+tabs+formatter.format(subTotal));
subTotal = 0;
}




pageContent.append("\n");
parameters = new StringBuffer();
headers = new StringBuffer();


out.println("<tr>");
for(int j =0; j< columnsCount; j++)
{
if( j == columnsCount-1){
out.println("<td class=\"TrtblC_ra\" colspan=\"1\"><a class=\"DLnk\" href=\""+calledPage+"?parameters="+(parameters.toString()).replace('&','^') .rep lace('+','|').replace('%','~').replace('"','*')+"&headers="+headers.toStrin g().r eplace('&','^').replace('+','|')+"&condition="+condition.toString().rep lace('%', '~').replace('&','^').replace('+','|')+"&searchBy="+searchBy+"&exp_ from_date="+e xp_from_date+"&exp_to_date="+exp_to_date+"&from_month="+from_month+" 8;to_month="+ to_month+"\">"+formatter.format(fetchRS.getDouble(j+1))+"</a></td&g t; ;");
totalINR = totalINR + fetchRS.getDouble(j+1);
subTotal = subTotal + fetchRS.getDouble(j+1);
pageContent.append(formatter.format(fetchRS.getDouble(j +1))+"\t");
}else{
out.println("<td class=\"TrtblS_la\" colspan=\"1\">"+fetchRS.getString(j+1)+"</td>");
pageContent.append(fe tchRS.getString(j+1)+"\t");
if((Columns.get(j).toString()).equals("PROJ_DESCRIPT ION")){
parameters.append(" and "+Columns.get(j)+" like'"+fetchRS.getString(j+1).replace('"','*')+"%'");
}else{
if((Columns.get(j) .toString()).equalsIgnoreCase("CUSTOMER_NAME")){
parameters.append(" and customer_id $'"+fetchRS.getString("customer_id")+"'");
}else{
parameters.append(" and "+Columns.get(j)+"$'"+fetchRS.getString(j+1)+"'");
}

}//end if
headers.append(" "+Headings.get(j)+"$"+fetchRS.getString(j+1)+(j%2==0?"<BR>":" "));
}//End of IF
}// End of For
out.println("</tr>");
recCount++;
tempValue = fetchRS.getString(1);
firstLoop = false;
}//END OF WHILE

</code>


Viswanatha Basavalingappa

Posts: 84
Nickname: viswagb
Registered: Nov, 2003

Re: Records In JSp & backend Differ ?? Posted: Nov 18, 2003 1:28 AM
Reply to this message Reply
hi

check with the index you have used.
First you should not hard code the index. and I feel the Record set index should start from 0 not 1.

===> fetchRS.getString(1)

Flat View: This topic has 1 reply on 1 page
Topic: Usage of java runtime class in web services Previous Topic   Next Topic Topic: Servlet Context

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use