JSF将Object传递给另一个页面

时间:2013-02-26 10:18:24

标签: jsf hyperlink commandbutton

我正在尝试将对象传递到另一个网站。所以我有我的Gallery.xhtml,我将对象设置为当前并重定向到另一个页面:

<h:form>
        <a4j:commandButton value="Edit Skin"
            action="#{helloBean.setCurrentSkin(skin)}"
            onclick="window.location.href = 'resources/html/Editor.xhtml';" />
</h:form>

但是当调用第二页上的getter时,当前对象再次为null。

是否为每个页面生成了bean?我怎么能做到这一点?

1 个答案:

答案 0 :(得分:0)

我的问题是我将我的bean声明为@ViewScoped,但正确的标记为@SessionScoped。这可以确保Bean保存整个会话的值,而不仅仅是一个视图。

相关问题