trivia
Class QuizBean

java.lang.Object
  extended by trivia.QuizBean
All Implemented Interfaces:
java.io.Serializable

@Named
@SessionScoped
public class QuizBean
extends java.lang.Object
implements java.io.Serializable

This is the main bean class for the Trivia Quiz application. It should get information about quiz categories from the CategoryBean class and information about specific questions from the ProblemBean class. You must complete the QuizBean class, and you must write the CategoryBean and ProblemBean classes. You might want to define other supporting classes as needed.

See Also:
Serialized Form

Constructor Summary
QuizBean()
           
 
Method Summary
 java.lang.String checkAnotherAnswer()
          This method is called after the user has answered a question other than the first.
 java.lang.String checkFirstAnswer()
          This method is called after the user has answered the first question.
 java.lang.String chooseCategory(java.lang.String category)
          This method is called from index.html when the user has clicked one of the four quiz buttons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuizBean

public QuizBean()
Method Detail

chooseCategory

public java.lang.String chooseCategory(java.lang.String category)
This method is called from index.html when the user has clicked one of the four quiz buttons. It receives a category string from the clicked button. The string is used to initiate a series of questions in that category.

Parameters:
category - the category selected by the user
Returns:
the string "first" in order to navigate to first.xhtml

checkFirstAnswer

public java.lang.String checkFirstAnswer()
This method is called after the user has answered the first question. The user's answer is checked for correctness and any necessary updating is done. It always navigates to rest.xhtml

Returns:
the string "rest" in order to navigate to rest.xhtml

checkAnotherAnswer

public java.lang.String checkAnotherAnswer()
This method is called after the user has answered a question other than the first. It can navigate either back to rest.xhtml if there are more questions to be asked in the category, or to done.xhtml if there are none.

Returns:
either "done" or "rest"