reset password
Author Message
wsakura
Posts: 64
Posted 00:50 Feb 08, 2013 |

I've been trying lots of different things, but I can't seem to figure out the whole lab.

For Lab2 Part2, I'm sure were supposed to add an index property, but I can't seem to figure out where or how. I've been trying to add it to AddComment, but I can't seem to get the index to increment.

As for Part3, I can get all the questions to print, but I can't seem to figure out how to only print one question and then print the next one when a user clicks the next button. I'm pretty sure it goes something like this:

print one question with next button
if users selects the next button
--calc score and go to the next question
if this is the last question, print a finish button instead of the next button
once the finish button is selected, give them their score

However, I haven't had any luck figuring this out.

Can someone help me?

cysun
Posts: 2935
Posted 00:58 Feb 08, 2013 |

For Part 2, you don't need to add anything to the beans. Use the varStatus attribute of <c:forEach> to get the index of each entry.

For Part 3, when a user clicks Next, you want to submit two parameters: the answer selected by the user (using the radio button), and currentQuestionIndex (using a hidden field with the value ${dt.currentQuestionIndex+1}. The second parameter will increment currentQuestionIndex so the user can move on to the next question.

wsakura
Posts: 64
Posted 01:04 Feb 08, 2013 |
cysun wrote:

For Part 2, you don't need to add anything to the beans. Use the varStatus attribute of <c:forEach> to get the index of each entry.

For Part 3, when a user clicks Next, you want to submit two parameters: the answer selected by the user (using the radio button), and currentQuestionIndex (using a hidden field with the value ${dt.currentQuestionIndex+1}. The second parameter will increment currentQuestionIndex so the user can move on to the next question.


 I'll try this out. I knew we had to use the varStatus, but I was only using it in the DrivingTest. I'll try it out with the edit comment.

Thanks Professor.

wsakura
Posts: 64
Posted 05:12 Feb 08, 2013 |

Nevermind. I fixed it.

Last edited by wsakura at 05:34 Feb 08, 2013.