JSP页面循环保存数据的问题?
a.jsp
String [] str = new String [30];
String [] dbData = new String [6];
String sql = "select a.username,a.password, b.username, age, sex, tel from spume0710 a, spume0711 b where a.userid=b.userid";
int count = 0;
while(rs.next()){
for(int i = 1; i <= rs.getMetaData().getColumnCount(); i++){
str[count] = rs.getString(i);
count++;
}
}
for(int j = 0; j < str.length; j++){
if(uname.equals(str[j]) && psw.equals(str[j+1])){
for(int m = 0; m < dbData.length; m++){
request.setAttribute("dbData[" + m + "]", str[m*j+m]);
}
b = true; break;
}else{
b = false;
}
}
b.jsp
<p>姓名:<%=request.getAttribute("dbData[2]")%></p> // 值为null
<p>年龄:<%=request.getAttribute("dbData[3]")%></p> // 值为null
<p>性别:<%=request.getAttribute("dbData[4]")%></p> // 值为null
<p>电话:<%=request.getAttribute("dbData[5]")%></p> // 值为null
请问为什么保存不了值 ??