[jboss-user] [JBoss Seam] - impossible usecase?

obfuscator do-not-reply at jboss.com
Sat Aug 25 04:57:42 EDT 2007


Hi

I have a problem that I've tried to solve for quite some time with seam. I'll give you a simple example that shows the conceptual problem. Any guidance on how to solve this problem would be greatly appriciated.

Let's say that I'm developing an application for displaying post-its. Users can add new post-its with custom text, and they are persisted until next login.

A post-it has a view (postit.jsp) and a backing bean (SFSB, PostIt.java). Now, I want
to be able to create several post-its, sharing the same view and backing-bean, just initiated with different texts.

I find this being a huge problem with seam. How can i have several instances of the same components coexisting, with just different initialization? 

What I've done is a hack. The postIt.jsp page calls a hack function, setting
a variable in the backing bean (postItId=3) or something. Now I can diffrentiate between postIts in my factory method, and set the text accordingly, but there is one huge problem still: All post-its share the same backing-bean instance. 

Now, since I don't want all post-its showing the same text, how can I let them have different backing beans instances? Well, there is conversations,
but I cannot start more than one per request, so I cannot start one
conversation per post it when the user logs in. The crux is that the
conversations need to be started before the first page is shown, so triggering conversations through user actions is not an option.
Using component roles could maybe work, but they are very static in 
nature, and would not provide a good solution as far as I can see.

It would be nice if there could be some mechanism that would identify 
the requesting view, so that several 
identical views could coexist within the same context, with separate 
backing bean instances. A candidate for such an identifier could be the
position of the component in the JSF tree or similar.

Anyway, even though this is a simple example, i believe that this might
become a big problem. I mean, not being able to keep separate instances
of views is sort of a big problem, and feels very non-OO.

I've probably overlooked the obvious solution, so I'm asking people here
how they would solve this problem.



Best Regards

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077986#4077986

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077986



More information about the jboss-user mailing list