I'd rather not introduce spring as yet another dependency on this project...especially because I know very little about it and don't have the time to tinker w/ it for this project.

What about passing the ShoppingCart EJB stub around in my page constructors instead of using a getter/setter in my custom UserSession class?  Wouldn't that be safe?

On 3/29/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
you can inject the proxy into any component

look at wicket-spring project

you can create a IFieldValueFactory that injects a proxy for your stateful bean.

-Igor



On 3/29/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
I'm sitting here, pondering, and getting fatter.  I'm building a storefront app w/ a simple shopping cart for which I'm thinking of using a Stateful session bean (EJB 3.0).

It looks like, no matter how I look at it, I'll have to keep the SFSB stub in-session throughout its use in the application...and I'm not sure of a real elegant way of doing that.  So, I was just hoping someone here could provide some insight.

In Wicket, I've already got a class called UserSession which I use to pass around an User so I can test whether or not a page is accessible by certain user groups.  I decided, to keep it simple, that I'd add a getter & setter for my ShoppingCart stub in the same class so it could be passed around in-session w/ the User, since each shopper will have an User automatically created for them before checking out and paying.

The problem w/ all this SFSB business is; it violates my design because I have to make my web tier talk directly to my session bean in order to keep track of its state.  For everything else I've been using a handful of proxy classes where I could place calls to my session beans and other business logic.

It looks a little like this:

Wicket->ProxyClass->SessionBean->Database

So, now I'll have to keep track of the ShoppingCart stub class in Wicket, pass the ShoppingCart and the users' chosen form values into the Proxy, perform business logic, and then return a ShoppingCart which I'll have to place *back* into the UserSession.setCart() method to continue to keep track of the state of the users' carts.

This is kinda nasty, is there an easier (or just more elegant) way to do this?

Thanks all!


Reply via email to