开发者

How do I pass parameters between request-scoped beans

This is a question that has been bothering me for sometime. 开发者_Go百科My application uses ICEFaces for our UI framework and Spring 2.5 for Dependency Injection. In addition, Spring actually maintains all of our backing beans, not the ICEFaces framework, so our faces-config is basically empty.

Navigation is not even really handled through navigation-rules. We perform manual redirects to new windows using window.open.

All of our beans are defined in our appContext file as being request-scoped. I have Page ABC which is backed by BackingBeanABC. Inside that backing bean, I have a parameter say:

private Order order;

I then have Page XYZ backed by BackingBeanXYZ. When I redirect from page ABC to page XYZ, I want to transfer the 'order' property from ABC to XYZ. The problem is since everything is request-scoped and I'm performing a redirect, I am losing the value of 'description'.

There has got to be an easier way to pass objects between beans in request scope during a redirect. Can anyone assist with this issue?


Session scope solves your issue.

You can read more about it in Spring's reference documentation.

Another alternative is to set the order object directly on the HttpSession object. I would have prefered that and only have your services, controllers and repositories managed by Spring.


Create a single session scoped bean that the request scoped beans can reference via the FacesContext.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜