开发者

Passing request scoped beans from one page to another

开发者 https://www.devze.com 2023-03-19 22:37 出处:网络
If I have a request scope bean on a page in JSF2....how do I pass it to another page (I\'m using JSF2 with Spring)?

If I have a request scope bean on a page in JSF2....how do I pass it to another page (I'm using JSF2 with Spring)?

I've tried the following but it doesnt work:

<h:commandButton action="complete.xhtml?faces-redirect=true"  value=开发者_如何学Python"Confirm Booking">
        <f:setPropertyActionListener target="#{quoteHolder.item}" value="#{quoteHolder.item}"/>
</h:commandButton>


action="complete.xhtml?faces-redirect=true"

You're sending a redirect. The <f:setPropertyActionListener> won't help much here as the request scoped bean will be garbaged after the invoke action phase anyway.

You have basically the following options:

  1. Send all the data as request parameter(s) instead (conversion to/from String necessary!)

  2. Don't send a redirect (the <f:setPropertyActionListener> becomes superfluous then)

  3. Store it in a session scoped bean (not recommended! may be bad for user experience).

0

精彩评论

暂无评论...
验证码 换一张
取 消