CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2008
    Posts
    1

    Question 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.

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    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

  3. #3
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    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 &#91;CODE]..&#91;/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 &#91;CODE]...your code here...&#91;/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  4. #4
    Join Date
    Nov 2007
    Posts
    28

    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
    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
    dilorde, may I ask if it is not because of the array bounds ? lol

  5. #5
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    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

    All truths are easy to understand once they are discovered; the point is to discover them...
    G. Galilie
    Please use &#91;CODE]...your code here...&#91;/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
  •  





Click Here to Expand Forum to Full Width

Featured