注册 登录
编程论坛 J2EE论坛

[求助]jsp问题,很是感谢。

ue1984 发布于 2006-05-17 15:37, 472 次点击

可以获取数据,但打印结果全为null
<%
int count=0;
if (session.getAttribute("count")!= null )
{
count = Integer.parseInt((String)session.getAttribute("count"));
out.println(count);

String subject[] = new String[count+1];
String name[] = new String[count+1];
String time[] = new String[count+1];

time[count] = (String)session.getAttribute("time[count]");
name[count] = (String)session.getAttribute("name[count]");
subject[count] = (String)session.getAttribute("subject[count]");

//for (int i = 0 ; i < time.length ; i++)
//out.println(time[i]);

for (int i = 0 ; i < count+1 ; i++)
{
%>
<table width="768" border="1" align="center">
<tr bgcolor="#CCCCCC">
<td>&nbsp;<%=subject[i]%></td>
<td>&nbsp;<%=name[i]%></td>
<td>&nbsp;<%=time[i]%></td>
</tr>
</table>
<%}}%>

1 回复
#2
ue19842006-05-18 13:57

又是自问自答,呵呵,就算自得其乐了。
用while作循环调用就好。这样太麻烦了。呵呵

1