Jinesh Varia wrote:

Please help me with this small code. I will do the rest. I have client implemented in JSP


public void printPersons(JspWriter out, Person[] persons) throws IOException {
                
                int j=0;
                while(persons[j]!=null){
                        out.write("<a class=fl href='person/perid"
                        +persons[j].getPerID()+"'>"+persons[j].getPersonName()+"</a>"
                                +"<br/>");
                        j++;
                }
                        
}

You should use a for loop for this, since you are just printing out the entire array.
for (int t = 0; t < persons.length; t++) {
your code
}


Because none of the elements is null it just continues to increment until it tries to access an element that is out of bounds.







Reply via email to