java Application help me...ID CARD SWAP IN MUSTER FORMAT
i have records in my arraylist time
id date intime outtime
A01 17 inouttime for that particular date
A01 18
A01 20
A02 21
A02 22
A02 23
i want to show record in muster format
id 1 2 3 4 5 6 7 8 9 10 ---- 17 18 19 20-----til 31ist
A01 inout inout inout
A02 same as follows
i am getting values in jsp
Arraylist time= (Arraylist).request.getAttribute("time");
item= time.get(0);
String current id= item.getid;
Arraylist att= new Arraylist();
Arraylist attdate= new Arraylist();
Arraylist att1= new Arraylist();
for(int i=0;i<time.size();i++)
string id= item.getid();
if(id.eauals(currentid)){
att.add(inout);
attdate.add (date);
} else{
int l=1;
while(l<=31){
for(k=0;k<=att.size;k++){
int s= (INTEGER) attdate.get(k);
if(s==l){
att1.add(att.get(k));
l++;k++;i++}else{
att1.add(null);}
hashmap.put(currentid, att1)
att= new arraylist
currentid=id;
}
this code is throwing me INDEXOUT OF BOUND exception.for first record it is showing me all records till that is store in last record in arraylist att after wards it is giving me the above exception
Re: java Application help me...ID CARD SWAP IN MUSTER FORMAT
Please copy and past full text of the error message.
for(k=0;k<=att.size;k++){
int s= (INTEGER) attdate.get(k);
k is tested against att but indexes attdate
Re: java Application help me...ID CARD SWAP IN MUSTER FORMAT
Quote:
Originally Posted by anukatoch
if(id.eauals(currentid)){
...
this code is throwing me INDEXOUT OF BOUND exception.
I don't see how that code can throw anything - it won't even compile with typos like that. If you expect help debugging your code, post it correctly formatted in the [CODE]..[/CODE] tags, and make sure you post exactly the code you want help with (copy & paste it).
Optimism is an occupational hazard of programming: testing is the treatment...
K. Beck
Re: java Application help me...ID CARD SWAP IN MUSTER FORMAT
Quote:
Originally Posted by dlorde
I don't see how that code can throw anything - it won't even compile with typos like that. If you expect help debugging your code, post it correctly formatted in the
tags, and make sure you post
exactly the code you want help with (copy & paste it).
Optimism is an occupational hazard of programming: testing is the treatment...
K. Beck
dilorde, may I ask if it is not because of the array bounds ? lol
Re: java Application help me...ID CARD SWAP IN MUSTER FORMAT
Quote:
Originally Posted by Username555
dilorde, may I ask if it is not because of the array bounds ? lol
You may ask anything you like :wave:
All truths are easy to understand once they are discovered; the point is to discover them...
G. Galilie