JSF 2 简介: JSF 向导
2010-08-26 00:00:00 来源:WEB开发网index.xhtml facelet 用 Start the wizard 链接启动这个应用程序,而 done.xhtml facelet 则显示了问题和答案的总结。
对于客户机,就介绍这么多。在服务器上,应用程序有三个 bean,我们接下来将讨论其中的两个。
此应用程序的两个 question bean
Question bean,如清单 1 所示,实际上是一个问题、一组答案选项以及一个答案:
清单 1. Question bean
package com.clarity;
import java.io.Serializable;
public class Question implements Serializable {
private static final long serialVersionUID = 1284490087332362658L;
private String question, answer;
private String[] choices;
private boolean answered = false; // next button is enabled when answered is true
public Question(String question, String[] choices) {
this.question = question;
this.choices = choices;
}
public void setAnswer(String answer) {
this.answer = answer;
answered = true;
}
public String getAnswer() { return answer; }
public String getQuestion() { return question; }
public String[] getChoices() { return choices; }
public boolean isAnswered() { return answered; }
public void setAnswered(boolean answered) { this.answered = answered; }
}
更多精彩
赞助商链接