I have the following problem:
I need a form to submit test questions. Therefore, the form should contain a field for the question (question statement), and several fields for the alternatives.
With this, I wanted the values of the input's of the alternatives to go straight to a list of alternatives instantiated in the respective bean.
So we have the class Option:
public class Opcao {
private int idOpcao;
private String nomeOpcao;
public int getIdOpcao() {
return idOpcao;
}
public void setIdOpcao(int idOpcao) {
this.idOpcao = idOpcao;
}
public String getNomeOpcao() {
return nomeOpcao;
}
public void setNomeOpcao(String nomeOpcao) {
this.nomeOpcao = nomeOpcao;
}
}
And the bean containing the list of options:
@ManagedBean
@ViewScoped
public class QuestaoBean {
private List<Opcao> opcoes;
public List<Opcao> getOpcoes() {
return opcoes;
}
public void setOpcoes(List<Opcao> opcoes) {
this.opcoes = opcoes;
}
}