本文整理汇总了Java中javax.faces.application.FacesMessage.setSummary方法的典型用法代码示例。如果您正苦于以下问题:Java FacesMessage.setSummary方法的具体用法?Java FacesMessage.setSummary怎么用?Java FacesMessage.setSummary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.application.FacesMessage
的用法示例。
在下文中一共展示了FacesMessage.setSummary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceMessageInListIfExisting
import javax.faces.application.FacesMessage; //导入方法依赖的package包/类
public static boolean replaceMessageInListIfExisting(String oldKey,
Object[] oldParams, String newKey, Object[] newParams) {
FacesContext fc = FacesContext.getCurrentInstance();
String oldText = JSFUtils.getText(oldKey, oldParams);
String newText = JSFUtils.getText(newKey, newParams);
for (Iterator<FacesMessage> i = fc.getMessages(); i.hasNext();) {
FacesMessage fm = i.next();
if (fm.getDetail().equals(oldText)) {
fm.setDetail(newText);
fm.setSummary(newText);
return true;
}
}
return false;
}
示例2: givenJSFUtilsMessage
import javax.faces.application.FacesMessage; //导入方法依赖的package包/类
/**
* @param contextStub
*/
@SuppressWarnings("unused")
private void givenJSFUtilsMessage(FacesContextStub contextStub, String key,
String value, Object[] params) {
setResourceBundle(contextStub, key, value);
FacesMessage firstFM = new FacesMessage(FacesMessage.SEVERITY_WARN,
value, null);
firstFM.setDetail(value);
firstFM.setSummary(value);
contextStub.addMessage(null, firstFM);
}
示例3: addFacesMessage
import javax.faces.application.FacesMessage; //导入方法依赖的package包/类
private void addFacesMessage(BusinessException be) {
FacesMessage facesMessage = new FacesMessage();
if (has(be.getSummary())) {
facesMessage.setSummary(be.getSummary());
}
if (has(be.getDetail())) {
facesMessage.setDetail(be.getDetail());
}
if (has(be.getSeverity())) {
facesMessage.setSeverity(be.getSeverity());
} else {
facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
}
Messages.add(be.getFieldId(), facesMessage);
}