Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

session.setAttribute & getAttribute in while loop

843836Sep 14 2004 — edited Sep 15 2004
I am trying to setAttribute in a loop. But I couldn't get any data (null) on the next page. Following are my scripts.

1st Page:

int m=0;
int g=0;

for (int x=1; x <= counter; x++) {
for (int y=1; y <= counter; y++) {

result[m] = x + "-" + y;
answer[m] = request.getParameter(result[m]);
m++;
}
}


while (g < total) {
session.setAttribute("answer[g]",answer[g]);
g++;
}

2nd Page:
int l=0;
while (l < total) {
result[l] = "answer[" + l + "]";
answer[l] = (String) session.getAttribute(result[l]);
l++;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 13 2004
Added on Sep 14 2004
2 comments
174 views