@buntineSep 09.2004 — #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.
@PtazauthorSep 09.2004 — #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());.
<%
if (request.getSession().getAttribute("RecSource") != null) {
if (request.getSession().getAttribute("SearchFlag") != "FALSE" ) {
@buntineSep 10.2004 — #Weird. I think the problem may lie elsewhere... Unless JSP does not support System.out, which would be surprising. <i> </i><% if (request.getSession().getAttribute("RecSource") != null) { if (request.getSession().getAttribute("SearchFlag") != "FALSE" ) { Vector rset = (Vector)request.getSession().getAttribute("RecSource"); %> <%= rset %> <% } } %>
@PtazauthorSep 13.2004 — #no error. Just no records or lines being printed.
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???
@Khalid_AliSep 13.2004 — #the first place to look for an error is the lines below
[b]
int ColIndex1 = RowVal.indexOf(Sep);
String AgentName = RowVal.substring(0,ColIndex1);
[/b]
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
@PtazauthorSep 13.2004 — #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?
@PtazauthorSep 15.2004 — #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.