I have a JSP page that looks somewhat like this:
[code]
int i = 1;
int numOfAnswers = Integer.parseInt((String) session.getAttribute("numOfAnswers"));
out.print("
Enter the answers to the previous question you submited:
");
out.print("If you need to the orignal answer amount use the ADD/REMOVE buttons
");
while(i <= numOfAnswers){
out.print(i + ". <input type="text" name="answer" + numOfAnswers + "">
");
i++;
}
out.print("");
out.print(" ");
out.print(" ");
}
[/code]
Depending on which button is pressed the servlet add's or subtracts a text input box and redisplays. The problem I'm having is keeping the values that are store in the box. When the page reloads none of the input values are saved.
Someone mentioned something to me about Client side loading. How would I do that with JSP?
Or if you can't help with that, how would I go about keeping the values in the input boxes after a user clicks add/remove?
thanks
Strick
Comments
:
: [code]
: int i = 1;
: int numOfAnswers = Integer.parseInt((String) session.getAttribute("numOfAnswers"));
: out.print("Enter the answers to the previous question you submited:");
: out.print("If you need to the orignal answer amount use the ADD/REMOVE buttons");
: while(i <= numOfAnswers){
: out.print(i + ". <input type="text" name="answer" + numOfAnswers + "">");
: i++;
: }
: out.print("");
: out.print(" ");
: out.print(" ");
: }
: [/code]
:
: Depending on which button is pressed the servlet add's or subtracts a text input box and redisplays. The problem I'm having is keeping the values that are store in the box. When the page reloads none of the input values are saved.
:
: Someone mentioned something to me about Client side loading. How would I do that with JSP?
:
: Or if you can't help with that, how would I go about keeping the values in the input boxes after a user clicks add/remove?
:
: thanks
:
: Strick
:
Hi,
I am not quite understand exactly the problem you described, but let me point out some issues I am seeing.
The first problem is that you are mixing the input text field with the textarea field.
The second problem that I did not see the value attribute of the text field at all. Are you suppose write the result into the value attribute?