Getting NullPointerException while putting data in hashtable
I have invoked the web service method which gives the list of students
information.
StudentsInfo si = getInfo(username, rollno, class); // web service method
invoked
Hashtable hashStudList = new Hashtable();
int size = si.getInfo().size();
for(int i=0;i<size;i++)
{
StudentsList st = new StudentsList();
String ID = si.getInfo().get(i).getStId().toString();
st.setId(ID);
st.setName(si.getInfo().get(i).getStName().toString());
st.setAddress(si.getInfo().get(i).getStAddress().toString());
st.setPhone(si.getInfo().get(i).getStPhone().toString());
..................
..................
hashStudList.put(ID, st);
}
StudentsList is the bean class containing getter and setter. But it gives
null pointer exception at String ID =
si.getInfo().get(i).getStId().toString(); while executing it. Am i doing
anything wrong. Please Help me soon. Thanks in advance.
No comments:
Post a Comment