mercredi 8 juin 2016

Output random object attribute in a JSF page

I have an ArrayList of Question Class objects and I need to output the random selected question in a JSF page. How can i do this?

public class GameBean implements Serializable {

private Random random;
private String question; 
private String answer;
//above are the attributes

METHOD

public Questions questionRandom() {
    int index = random.nextInt(questionList.size());
    Question q = questionList.get(index);

    return q;
}

JSF

<h:outputLabel value="#{??????}" />

what do I have to whrite in the question marks?




Aucun commentaire:

Enregistrer un commentaire