package com.corejsf; import java.io.Serializable; import java.util.ArrayList; public class ProblemBean implements Serializable { private ArrayList<Integer> sequence; private int solution; public ProblemBean() {} public ProblemBean(int[] values, int solution) { sequence = new ArrayList<Integer>(); for (int i = 0; i < values.length; i++) sequence.add(values[i]); this.solution = solution; } public ArrayList<Integer> getSequence() { return sequence; } public void setSequence(ArrayList<Integer> newValue) { sequence = newValue; } public int getSolution() { return solution; } public void setSolution(int newValue) { solution = newValue; } }
This application uses many ProblemBean objects, one for each quiz question. For this reason, it does not make sense to use JSF bean management. Instead, the ProblemBean objects are accessed indirectly through the quiz bean of the application. To make this indirect access work the Java bean naming conventions must be observed.
ProblemBean objects have two bean properties: