将以下代码添加至“快速编辑”视图的右窗格: String text1Val = (String)getSecret1().getValue();
String text2Val = (String)getSecret2().getValue();
System.out.println("text2Val = " + text1Val + " text2Val = " + text2Val);
if(!text1Val.equals(text2Val)){
System.out.println("NOT THE SAME");
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Passwords need to be the same", "Values should be the same");
getMessages1().setErrorStyle("color:Red");
getFacesContext().addMessage(null, message);
return "errorCondition";
}
return "successCondition";
FacesMessage 具有下列构造函数:
FacesMessage()
FacesMessage(FacesMessage.Severity, String summary, String detail)
FacesMessage(String summary)
FacesMessage(String summary, String detail)