本文整理汇总了Java中javax.faces.context.Flash.setKeepMessages方法的典型用法代码示例。如果您正苦于以下问题:Java Flash.setKeepMessages方法的具体用法?Java Flash.setKeepMessages怎么用?Java Flash.setKeepMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.context.Flash
的用法示例。
在下文中一共展示了Flash.setKeepMessages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: navigateToBookingsPage
import javax.faces.context.Flash; //导入方法依赖的package包/类
protected String navigateToBookingsPage(Reservation realReservation) {
Flash flash = getCurrentInstance().getExternalContext().getFlash();
FacesMessage message = new FacesMessage(format("Room %s is booked for %s; Reservation number %s; Cost: %s EUR",
booking.getRoom(), booking.getGuest(), realReservation.getReservationNumber(),
realReservation.getCostsInEuro()));
getCurrentInstance().addMessage(null, message);
booking = null;
flash.setKeepMessages(true); // only keep messages if we do not have a backlink
return format("/booking.xhtml?reservationNumber=%s&faces-redirect=true", realReservation.getReservationNumber());
}
示例2: addFlashMessage
import javax.faces.context.Flash; //导入方法依赖的package包/类
public static void addFlashMessage(Severity severity, String summary) {
Flash flash = getCurrentInstance().getExternalContext().getFlash();
flash.setKeepMessages(true);
FacesMessage message = new FacesMessage(severity, summary, summary);
getCurrentInstance().addMessage(null, message);
}
示例3: keepFlashMessages
import javax.faces.context.Flash; //导入方法依赖的package包/类
public static void keepFlashMessages() {
FacesContext context = FacesContext.getCurrentInstance();
Flash flash = context.getExternalContext().getFlash();
flash.setKeepMessages(true);
flash.setRedirect(true);
}