This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Function not taking int value

 
Gale Greaser
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -
I have a very strange error.
I am calling this code within a JSP.
for(int i=index; i<(index + increment); i++)
{
RecordBean record = recordListBean.get(i);

}

All I would like to do is get the record at index 'i'in the function " RecordBean record = recordListBean.get(i); "
I get an error page if I do this (don't know the exact error message), however - if I create an " int j=4; ", for example and use RecordBean record = recordListBean.get(j);
- this works just fine.
I tried to "trick" the code and assigned "int j = i; " within the loop. It recognized this and errored on me again.
Why can this function take in one int variable and not another?
I'm very confused.
Please help.
Thanks in advance.
-Gale
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gale,
This is only a hunch, but since you start your loop with:

My guess is that i or index or increment or some interaction of the three is what the problem is. Perhaps when you call recordListBean.get(i) that i is invalid. You need to look closely at the exception that is thrown to locate whatever is causing the problem.
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic