-
July 31st, 2008, 12:54 AM
#1
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
Last edited by anukatoch; July 31st, 2008 at 01:46 AM.
-
July 31st, 2008, 06:21 AM
#2
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
Norm
-
July 31st, 2008, 01:26 PM
#3
Re: java Application help me...ID CARD SWAP IN MUSTER FORMAT
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
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
August 5th, 2008, 09:10 PM
#4
Re: java Application help me...ID CARD SWAP IN MUSTER FORMAT
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
-
August 6th, 2008, 04:20 AM
#5
Re: java Application help me...ID CARD SWAP IN MUSTER FORMAT
Originally Posted by Username555
dilorde, may I ask if it is not because of the array bounds ? lol
You may ask anything you like
All truths are easy to understand once they are discovered; the point is to discover them...
G. Galilie
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|