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

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

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

Flash.put介绍

[英]Puts a value in the flash so that it can be accessed on this traversal of the lifecycle, rather than on the next traversal. This is simply an alias for putting a value in the request map.
EL Usage Example

<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"> 
<!-- extra code removed --> 
<c:set target="#{flash.now}" property="bar" value="barValue" /> 
<p>Value of \#{flash.now.bar}, should be barValue.</p> 
<h:outputText value="#{flash.now.bar}" />

[中]将值放入闪存中,以便在生命周期的这一次遍历时可以访问它,而不是在下一次遍历时。这只是一个将值放入请求映射的别名。
EL使用示例

<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"> 
<!-- extra code removed --> 
<c:set target="#{flash.now}" property="bar" value="barValue" /> 
<p>Value of \#{flash.now.bar}, should be barValue.</p> 
<h:outputText value="#{flash.now.bar}" />

代码示例

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

Flash jsfFlash = FacesContext.getCurrentInstance().getExternalContext().getFlash();
jsfFlash.put("errorMsg", "error");
//Or jsfFlash.put("errorMsg", null) if there's no error.

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

Flash fScope = FacesContext.getCurrentInstance().getExternalContext().getFlash();
fScope.put("editMailer",edit_mailer);

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

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#put} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public Object put(String key, Object value) {
  return getWrapped().put(key, value);
}

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

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#put} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public Object put(String key, Object value) {
  return getWrapped().put(key, value);
}

代码示例来源:origin: IQSS/dataverse

public static void addWarningMessage(String message) {
     FacesContext.getCurrentInstance().getExternalContext().getFlash().put("warningMsg", message);      
  } 
public void addMessage( FacesMessage.Severity s, String summary, String details ) {

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

/**
 * @see Faces#setFlashAttribute(String, Object)
 */
public static void setFlashAttribute(FacesContext context, String name, Object value) {
  getFlash(context).put(name, value);
}

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

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#put} on the wrapped
 * {@link Flash} object.</p>
 * 
 * @since 2.2
 */
@Override
public Object put(String key, Object value) {
  return getWrapped().put(key, value);
}

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

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#put} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public Object put(String key, Object value) {
  return getWrapped().put(key, value);
}

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

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#put} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public Object put(String key, Object value) {
  return getWrapped().put(key, value);
}

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

/**
 * @see Faces#setFlashAttribute(String, Object)
 */
public static void setFlashAttribute(FacesContext context, String name, Object value) {
  getFlash(context).put(name, value);
}

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

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#put} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public Object put(String key, Object value) {
  return getWrapped().put(key, value);
}

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

public Object put(String key, Object value)
{
  return getWrapped().put(key, value);
}

代码示例来源:origin: IQSS/dataverse

public static void addErrorMessage(String message) {
   FacesContext.getCurrentInstance().getExternalContext().getFlash().put("errorMsg", message);      
} 
public static void addInfoMessage(String message) {

代码示例来源:origin: IQSS/dataverse

public static void addInfoMessage(String message) {
   FacesContext.getCurrentInstance().getExternalContext().getFlash().put("infoMsg", message);      
} 
public static void addWarningMessage(String message) {

代码示例来源:origin: IQSS/dataverse

public static void addSuccessMessage(String message) {
   FacesContext.getCurrentInstance().getExternalContext().getFlash().put("successMsg", message);
} 
public static void addFlashMessage(String message) {

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

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#put} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public Object put(String key, Object value) {
  return getWrapped().put(key, value);
}

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

/**
 * <p class="changed_added_2_2">The default behavior of this method
 * is to call {@link Flash#put} on the wrapped
 * {@link Flash} object.</p>
 *
 * @since 2.2
 */
@Override
public Object put(String key, Object value) {
  return getWrapped().put(key, value);
}

代码示例来源:origin: br.com.jarch/jarch-jsf

public static void setAttributeFlash(String nameAttribute, Object value) {
  getFlash().put(nameAttribute, value);
}

代码示例来源:origin: mysticfall/pivot4j

public String proceed() {
  FacesContext context = FacesContext.getCurrentInstance();
  Flash flash = context.getExternalContext().getFlash();
  ConnectionInfo connectionInfo = new ConnectionInfo(catalogName,
      cubeName);
  ViewState state = viewStateHolder.getState(viewId);
  if (state == null) {
    state = viewStateHolder.createNewState(connectionInfo, viewId);
    viewStateHolder.registerState(state);
  } else {
    OlapDataSource dataSource = dataSourceManager
        .getDataSource(connectionInfo);
    state.setModel(new PivotModelImpl(dataSource));
    state.setConnectionInfo(connectionInfo);
  }
  flash.put("connectionInfo", connectionInfo);
  flash.put("viewId", viewId);
  StringBuilder builder = new StringBuilder();
  builder.append("view");
  builder.append("?faces-redirect=true");
  builder.append("&");
  builder.append(settings.getViewParameterName());
  builder.append("=");
  builder.append(viewId);
  return builder.toString();
}

代码示例来源:origin: org.apache.myfaces.core.internal/myfaces-shaded-impl

@Override
public void setValue(ELContext context, Object base, Object property,
    Object value) throws NullPointerException,
    PropertyNotFoundException, PropertyNotWritableException,
    ELException
{
  if (property == null)
    throw new PropertyNotFoundException();
  if (!(property instanceof String))
    return;
  String strProperty = castAndIntern(property);
  if (FLASH.equals(strProperty))
  {
    throw new PropertyNotWritableException();
  }
  else if (base instanceof Flash)
  {
    context.setPropertyResolved(true);
    try
    {
      ((Flash) base).put(strProperty, value);
    }
    catch (UnsupportedOperationException e)
    {
      throw new PropertyNotWritableException(e);
    }
  }
}

相关文章