wood burning stoves 2.0*
The moose likes JSP and the fly likes Loop Porblems in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Loop Porblems in JSP" Watch "Loop Porblems in JSP" New topic
Author

Loop Porblems in JSP

bat ken
Greenhorn

Joined: Dec 28, 2005
Posts: 24
Halo

I am having a problem here, hope someone can help me My loop keep on replace the value in my variable. I want to get few lines of sentence, but I only able to print out/get the last sentence. It keep on replacing...

my code;
--------
for (int i=0; i < Cnt; i++)
{
if (request.getParameter("status"+arrOfRec_to_update[i]).equals ("R") && i==0)
{
Body="This is to inform you that your Material Requisition was REJECTED on "
+dte+
" by "
+SenderREJ+
"\n\n"
+"Details"+
"\n"
+"No."+" | "+"Material Item Code"+" | "+"Material Description"+" | "+"Qty/UM"+" | "+"Reason"+"\n"
+cnt+"|"+mtr_cde+"|"+in_desc_combine+"|"+qty+umdesc+"|"+pur+"|"+rec_status+"|"+remark+"\n"
+"\n"
+"Regards"+
"\n"+"BCT";
rCnt = rCnt + 1;
}
else if(request.getParameter("status"+arrOfRec_to_update[i]).equals ("R") && i!=0)
{
Body=cnt+"|"+mtr_cde+"|"+in_desc_combine+"|"+qty+umdesc+"|"+pur+"|"+rec_status+"|"+remark;
rCnt = rCnt + 1;
}
}

Thank you
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You are using "Body="
You should initialize Body to an empty string and use "Body += ".

Instead, use a StringBuffer and call the append() method.


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Loop Porblems in JSP
 
Similar Threads
Problems with counting short and long words
Unexpected operator sequence
IllegalArgumentException
Update more than one rows through one Submit/Update Button
Problem with MySQL syntax