• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Flash类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.faces.context.Flash的典型用法代码示例。如果您正苦于以下问题:Java Flash类的具体用法?Java Flash怎么用?Java Flash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Flash类属于javax.faces.context包,在下文中一共展示了Flash类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
 
开发者ID:koenighotze,项目名称:Hotel-Reservation-Tool,代码行数:11,代码来源:NewReservationBean.java


示例2: processEvent

import javax.faces.context.Flash; //导入依赖的package包/类
@Override
public void processEvent(SystemEvent event) throws AbortProcessingException {
    if (event instanceof PreRenderViewEvent) {
        UIViewRoot viewRoot = getUIViewRoot(event);
        if (null != viewRoot && StringUtils.isNotEmpty(viewRoot.getViewId())) {
            ExtendedActionListener listener
                = createActionEventListener(event, PROP_PRERENDER_PREFIX);
            if (null == listener) {
                listener = createActionEventListener(PRERENDER_DEFAULT_KEY);
            }
            if (null != listener) {
                ActionEvent ae = new ActionEvent(viewRoot);
                listener.processAction(ae);
                // 画面表示キー値、メッセージの設定
                //merActionListener.setViewMessage();
                String pageIdParameter = getPageIdParameter();
                if (StringUtils.isNotEmpty(pageIdParameter)) {
                    // 画面リダイレクト処理前のエラーメッセージ設定
                    listener.addViewMessage(pageIdParameter);
                    FacesContext fc = FacesContext.getCurrentInstance();
                    Flash f = fc.getExternalContext().getFlash();
                    f.clear();
                }
                listener.setViewMessage();
            } else {
                // デフォルトPreRenderも存在しない場合は処理エラーとする.
                throw new AbortProcessingException(
                        String.format("Can't create PreRenderViewListener. for viewId=[%s]",
                                getViewId(event)));
            }
        }
    }
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:34,代码来源:PreRenderViewListener.java


示例3: flashGet

import javax.faces.context.Flash; //导入依赖的package包/类
protected Object flashGet(String key) {
	Flash flash = flash();

	if (flash.size() > 0) {
		Object result = flash.get(key);

		if (isRemovingFlash()) {
			flash.values().remove(result);
		}

		return result;
	}
	return null;
}
 
开发者ID:persapiens,项目名称:conta,代码行数:15,代码来源:AbstractMBean.java


示例4: getFlash

import javax.faces.context.Flash; //导入依赖的package包/类
@Override
public Flash getFlash() {
    return new FlashMock();
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:5,代码来源:FacesContextMock.java


示例5: flash

import javax.faces.context.Flash; //导入依赖的package包/类
private Flash flash() {
	return FacesContext.getCurrentInstance().getExternalContext().getFlash();
}
 
开发者ID:persapiens,项目名称:conta,代码行数:4,代码来源:AbstractMBean.java


示例6: flashPut

import javax.faces.context.Flash; //导入依赖的package包/类
protected void flashPut(String key, Object value) {
	Flash flash = flash();
	flash.put(key, value);
}
 
开发者ID:persapiens,项目名称:conta,代码行数:5,代码来源:AbstractMBean.java


示例7: getFlash

import javax.faces.context.Flash; //导入依赖的package包/类
public static Flash getFlash() {
	return FacesContext.getCurrentInstance().getExternalContext().getFlash();
}
 
开发者ID:culturagovbr,项目名称:GOG,代码行数:4,代码来源:JSFUtils.java


示例8: 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);
}
 
开发者ID:koenighotze,项目名称:Hotel-Reservation-Tool,代码行数:7,代码来源:FacesMessageHelper.java


示例9: getFlash

import javax.faces.context.Flash; //导入依赖的package包/类
public static Flash getFlash(){
	return getEC().getFlash();
}
 
开发者ID:PeterFalken,项目名称:baseJSF,代码行数:4,代码来源:FacesUtil.java


示例10: handle

import javax.faces.context.Flash; //导入依赖的package包/类
@Override
public void handle() throws FacesException
{
    lazyInit();
    Iterator<ExceptionQueuedEvent> exceptionQueuedEventIterator = getUnhandledExceptionQueuedEvents().iterator();

    while (exceptionQueuedEventIterator.hasNext())
    {
        ExceptionQueuedEventContext exceptionQueuedEventContext =
                (ExceptionQueuedEventContext) exceptionQueuedEventIterator.next().getSource();

        @SuppressWarnings({ "ThrowableResultOfMethodCallIgnored" })
        Throwable throwable = exceptionQueuedEventContext.getException();

        String viewId = null;

        if (!isExceptionToHandle(throwable))
        {
            continue;
        }

        FacesContext facesContext = exceptionQueuedEventContext.getContext();
        Flash flash = facesContext.getExternalContext().getFlash();

        if (throwable instanceof ViewExpiredException)
        {
            viewId = ((ViewExpiredException) throwable).getViewId();
        }
        else if (throwable instanceof ContextNotActiveException)
        {
            //the error page uses a cdi scope which isn't active as well
            //(it's recorded below - see flash.put(throwable.getClass().getName(), throwable);)
            if (flash.containsKey(ContextNotActiveException.class.getName()))
            {
                //TODO show it in case of project-stage development
                break;
            }

            if (facesContext.getViewRoot() != null)
            {
                viewId = facesContext.getViewRoot().getViewId();
            }
            else
            {
                viewId = BeanProvider.getContextualReference(ViewConfigResolver.class)
                        //has to return a value otherwise this handler wouldn't be active
                        .getDefaultErrorViewConfigDescriptor().getViewId();
            }
        }

        if (viewId != null)
        {
            UIViewRoot uiViewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);

            if (uiViewRoot == null)
            {
                continue;
            }

            if (facesContext.isProjectStage(javax.faces.application.ProjectStage.Development) ||
                    ProjectStageProducer.getInstance().getProjectStage() == ProjectStage.Development ||
                    ProjectStageProducer.getInstance().getProjectStage() instanceof TestStage)
            {
                throwable.printStackTrace();
            }

            facesContext.setViewRoot(uiViewRoot);
            exceptionQueuedEventIterator.remove();

            //record the current exception -> to check it at the next call or to use it on the error-page
            flash.put(throwable.getClass().getName(), throwable);
            flash.keep(throwable.getClass().getName());

            this.viewNavigationHandler.navigateTo(DefaultErrorView.class);

            break;
        }
    }

    this.wrapped.handle();
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:82,代码来源:DefaultErrorViewAwareExceptionHandlerWrapper.java


示例11: 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);
}
 
开发者ID:diokey,项目名称:ums,代码行数:7,代码来源:FacesUtil.java


示例12: getFlash

import javax.faces.context.Flash; //导入依赖的package包/类
/**
 * Obtains the JSF Flash object.
 * 
 * @return The Flash object associated with the current request.
 */
protected Flash getFlash() {
	return getExternalContext().getFlash();
}
 
开发者ID:nemo-ufes,项目名称:nemo-utils,代码行数:9,代码来源:JSFController.java



注:本文中的javax.faces.context.Flash类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SitePaths类代码示例发布时间:2022-05-22
下一篇:
Java PdfCopy类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap