This exception subclasses IndexOutOfBoundsException. It is thrown by the String class when you try to reference an index (character position) that is less than zero, or in this case, greater than the length of the string.
You may want to show us the few lines of code around the line which threw the exception.
ok..this is the script that is in the search page. Don't know if that is what you want. There is a java class that dose the sql function aswell as session.setAttribute("RecSource", rset);session.setAttribute("SearchFlag", "TRUE");session.setAttribute("Postal", fullPC.toString());.
Would this to do with character string. where would one have defined this character strings?? e.g. in database filed mya have 30chars and then incereace to 50. Would you need to define this change in the java or something???
the first place to look for an error is the lines below
int ColIndex1 = RowVal.indexOf(Sep);
String AgentName = RowVal.substring(0,ColIndex1);
my first guess will be that ColIndex1 is not returning something that it should hence the RowVal.substring is throwing the exception....make sure that ColIndex1 as a value that can be used with substring
Thanks, that helps to see where I may be going wrong and now can say that it could be one of 2 things.
Would a NULL field in a record give this error?
The colIndex1 has company name, but on a previous database this field has 30 characters max but on the new one there are 50. same for the address field they used to be 30 on the previous database field but on the new its 60. Would this difference in the character field throw out the error. And how can I fix it?
Originally posted by Ptaz
Would a NULL field in a record give this error?
Most certainly.
[i]...the character field throw out the error. And how can I fix it? [/B]
Seriously doubt that.
the only reason you will get problems are if
int ColIndex1 = RowVal.indexOf(Sep);
does not return a valid value for substring function to process and return what you are asking for.
ok..I got the <%=rset%> but It still not returning any data. now if I use the same code with another table(same data, but different character strings), it displays the recods.
What am I doing wrong?? How can I check and fix the Indexof? or increase the character strings so that it displays properly.
Bookmarks