javax.faces.context.Flash.setKeepMessages()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中javax.faces.context.Flash.setKeepMessages()方法的一些代码示例,展示了Flash.setKeepMessages()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flash.setKeepMessages()方法的具体详情如下:
包路径:javax.faces.context.Flash
类名称:Flash
方法名:setKeepMessages

Flash.setKeepMessages介绍

[英]Setter for keepMessages JavaBeans property. See #isKeepMessages.
[中]keepMessagesJavaBeans属性的Setter。请参阅#isKeepMessages。

代码示例

代码示例来源:origin: javax.faces/javax.faces-api

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public void setKeepMessages(boolean newValue) {
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: eclipse-ee4j/mojarra

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public void setKeepMessages(boolean newValue) {
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: org.apache.myfaces.core/myfaces-api

@Override
public void setKeepMessages(boolean newValue)
{
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: javax/javaee-web-api

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public void setKeepMessages(boolean newValue) {
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: com.sun.faces/jsf-api

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped
 * {@link Flash} object.</p>
 * 
 * @since 2.2
 */
@Override
public void setKeepMessages(boolean newValue) {
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: omnifaces/omnifaces

/**
 * Make the current message a flash message. Use this when you need to display the message after a redirect.
 * @return The current {@link Message} instance for further building.
 * @see Flash#setKeepMessages(boolean)
 */
public Message flash() {
  getFlash().setKeepMessages(true);
  return this;
}

代码示例来源:origin: org.glassfish/jakarta.faces

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public void setKeepMessages(boolean newValue) {
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: eclipse-ee4j/mojarra

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public void setKeepMessages(boolean newValue) {
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: org.glassfish/javax.faces

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public void setKeepMessages(boolean newValue) {
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: org.omnifaces/omnifaces

/**
 * Make the current message a flash message. Use this when you need to display the message after a redirect.
 * @return The current {@link Message} instance for further building.
 * @see Flash#setKeepMessages(boolean)
 */
public Message flash() {
  getFlash().setKeepMessages(true);
  return this;
}

代码示例来源:origin: stackoverflow.com

FacesContext facesContext = FacesContext.getCurrentInstance();
Flash flash = getCurrentInstance().getExternalContext().getFlash();
flash.setKeepMessages(true);
facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "yourMessage", null));
return "namePage?faces-redirect=true";

代码示例来源:origin: jboss/jboss-javaee-specs

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public void setKeepMessages(boolean newValue) {
  getWrapped().setKeepMessages(newValue);
}

代码示例来源:origin: org.codehaus.openxma/dsl-platform-jsf

public static void redirectToPage(String viewId) {
  FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);
  String requestContextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
  String fullRedirectUrl = requestContextPath + "/" + viewId;
  try {
    System.out.println("Redirecting to " + fullRedirectUrl);
    FacesContext.getCurrentInstance().getExternalContext().redirect(fullRedirectUrl);
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  
}

代码示例来源:origin: org.omnifaces/omnifaces

/**
 * Add a flash scoped faces message to the given client ID. Use this when you need to display the message after a
 * redirect.
 * <p>
 * NOTE: the flash scope has in early Mojarra versions however some pretty peculiar problems. In older versions,
 * the messages are remembered too long, or they are only displayed after refresh, or they are not displayed when
 * the next request is on a different path. Only since Mojarra 2.1.14, all known flash scope problems are solved.
 * @param clientId The client ID to add the flash scoped faces message for.
 * @param message The faces message.
 * @see Flash#setKeepMessages(boolean)
 * @see #add(String, FacesMessage)
 */
public static void addFlash(String clientId, FacesMessage message) {
  getFlash().setKeepMessages(true);
  add(clientId, message);
}

代码示例来源:origin: omnifaces/omnifaces

/**
 * Add a flash scoped faces message to the given client ID. Use this when you need to display the message after a
 * redirect.
 * <p>
 * NOTE: the flash scope has in early Mojarra versions however some pretty peculiar problems. In older versions,
 * the messages are remembered too long, or they are only displayed after refresh, or they are not displayed when
 * the next request is on a different path. Only since Mojarra 2.1.14, all known flash scope problems are solved.
 * @param clientId The client ID to add the flash scoped faces message for.
 * @param message The faces message.
 * @see Flash#setKeepMessages(boolean)
 * @see #add(String, FacesMessage)
 */
public static void addFlash(String clientId, FacesMessage message) {
  getFlash().setKeepMessages(true);
  add(clientId, message);
}

代码示例来源:origin: org.apache.deltaspike.modules/deltaspike-jsf-module-impl

public static void saveFacesMessages(ExternalContext externalContext)
{
  JsfModuleConfig jsfModuleConfig = BeanProvider.getContextualReference(JsfModuleConfig.class);
  if (!jsfModuleConfig.isAlwaysKeepMessages())
  {
    return;
  }
  try
  {
    WindowMetaData windowMetaData = BeanProvider.getContextualReference(WindowMetaData.class);
    Map<String, Object> requestMap = externalContext.getRequestMap();
    @SuppressWarnings({ "unchecked" })
    List<FacesMessageEntry> facesMessageEntryList =
        (List<FacesMessageEntry>)requestMap.get(FacesMessageEntry.class.getName());
    if (facesMessageEntryList == null)
    {
      facesMessageEntryList = new CopyOnWriteArrayList<FacesMessageEntry>();
    }
    windowMetaData.setFacesMessageEntryList(facesMessageEntryList);
  }
  catch (ContextNotActiveException e)
  {
    //TODO log it in case of project-stage development
    //we can't handle it correctly -> delegate to the jsf-api (which has some restrictions esp. before v2.2)
    FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);
  }
}

代码示例来源:origin: org.apache.deltaspike.modules/deltaspike-jsf-module-impl-ee6

public static void saveFacesMessages(ExternalContext externalContext)
{
  JsfModuleConfig jsfModuleConfig = BeanProvider.getContextualReference(JsfModuleConfig.class);
  if (!jsfModuleConfig.isAlwaysKeepMessages())
  {
    return;
  }
  try
  {
    WindowMetaData windowMetaData = BeanProvider.getContextualReference(WindowMetaData.class);
    Map<String, Object> requestMap = externalContext.getRequestMap();
    @SuppressWarnings({ "unchecked" })
    List<FacesMessageEntry> facesMessageEntryList =
        (List<FacesMessageEntry>)requestMap.get(FacesMessageEntry.class.getName());
    if (facesMessageEntryList == null)
    {
      facesMessageEntryList = new CopyOnWriteArrayList<FacesMessageEntry>();
    }
    windowMetaData.setFacesMessageEntryList(facesMessageEntryList);
  }
  catch (ContextNotActiveException e)
  {
    //TODO log it in case of project-stage development
    //we can't handle it correctly -> delegate to the jsf-api (which has some restrictions esp. before v2.2)
    FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);
  }
}

代码示例来源:origin: org.glassfish/jakarta.faces

flash.setKeepMessages(true);
String viewIdBefore = context.getViewRoot().getViewId();
viewIdBefore = (null == viewIdBefore) ? "" : viewIdBefore;

代码示例来源:origin: eclipse-ee4j/mojarra

flash.setKeepMessages(true);
String viewIdBefore = context.getViewRoot().getViewId();
viewIdBefore = (null == viewIdBefore) ? "" : viewIdBefore;

代码示例来源:origin: com.sun.faces/jsf-impl

boolean isUIViewActionBroadcastAndViewdsDiffer = false;
if (UIViewAction.isProcessingBroadcast(context)) {
  flash.setKeepMessages(true);
  String viewIdBefore = context.getViewRoot().getViewId();
  viewIdBefore = (null == viewIdBefore) ? "" : viewIdBefore;

相关文章