Passing request scoped beans from one page to another
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:
Send all the data as request parameter(s) instead (conversion to/from
String
necessary!)Don't send a redirect (the
<f:setPropertyActionListener>
becomes superfluous then)Store it in a session scoped bean (not recommended! may be bad for user experience).
精彩评论