< c:set>的替代方案是什么?建立视图后? [英] What is the alternative to <c:set> after the view is built?

查看:113
本文介绍了< c:set>的替代方案是什么?建立视图后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建视图后,<c:set>的替代方案是什么? 通常,<c:set>在构建视图时起作用.之后,我该如何更改?

what is the alternative to <c:set> after the view is built ? Generally <c:set> works when the view is being built. After that, how do I change that ?

例如,JSF标签中的以下内容等效于什么?构建视图后,不会设置以下属性.

For example, what would be the equivalent of the following in JSF tag ? The following property is just not set after the view is built.

<c:set property="showPromoDetails" target="#{viewScope}" value="null" />

推荐答案

我将假设使用JSF2.x.将其放在视图中的某个地方,通用约定在顶部附近.

I'll assume JSF 2.x. Put this somewhere in the view, the common convention is somewhere near the top.

<f:metadata>
    <f:event type="preRenderView" listener="#{viewScope.preRenderView}" />
</f:metadata>

使用

public void preRenderView() {
    showPromoDetails = null;
}

这篇关于&lt; c:set&gt;的替代方案是什么?建立视图后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆