File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Function not taking int value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Function not taking int value" Watch "Function not taking int value" New topic
Author

Function not taking int value

Gale Greaser
Greenhorn

Joined: Aug 05, 2002
Posts: 17
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

Joined: Jan 30, 2002
Posts: 3451
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


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Function not taking int value