-
1. Re: The logical difference between a Bean and an Action?
gjeudy Aug 19, 2008 4:35 PM (in response to compiledmonkey)Bean is an overloaded term. You have Java beans which were not meant to have behavior but more like act like a dataholder class with getter/setters. Then you have EJBs which are alot more different and can act as stateless services or controllers.
To me an action is really similar to a controller because it is what binds with your view. If you add a JSF action on a command button, I would expect the action maps to a controller/action class.
The bean definition is so overloaded that I can't give a single explanation. But if you talk about a backing bean in JSF then usually the backing bean while hold the state for a view or a succession of views.
Without more details on your application I cannot really advise as to what to do with this exactly. Seam uses stateful beans to bind with the views, you can use SFSBs or plain java beans to fulfill this purpose. You can have both state and actions within the same class or you can organize differently. If you need to abstract the service layer you can always have the stateful bean delegate calls to your service layer.
The choice is yours.
-
2. Re: The logical difference between a Bean and an Action?
compiledmonkey Aug 19, 2008 4:46 PM (in response to compiledmonkey)Thanks for the reply. I'm on the same page and what you said makes me feel better about my understanding thus far. I think I'll just re-purpose my controllers as stateful session beans (EJB3) that make the calls to the service layer. The controllers are composite in the sense that they have instances of objects that are used directly in the views. So yeah, I think I'm looking good. :)
-
3. Re: The logical difference between a Bean and an Action?
mail.micke Aug 19, 2008 5:15 PM (in response to compiledmonkey)They don't even have to be EJB3's, can be normal pojos just like in your current app (simply remove the managed bean definitions in faces-confg.xml and annotate them).
-
4. Re: The logical difference between a Bean and an Action?
compiledmonkey Aug 19, 2008 5:20 PM (in response to compiledmonkey)That would definitely make the migration easier. Do you know what changes I need to make to a generated project from seam-gen in order to go from a ear deployed project to war based?
-
5. Re: The logical difference between a Bean and an Action?
mail.micke Aug 19, 2008 5:45 PM (in response to compiledmonkey)Hi
Afraid I don't, never used the seam-gen stuff myself. Never liked the directory layout (maven user :) ).
But there isn't much configuration needed to get things working. It is all under chapter 1.2 of the seam documentation (I'm using 2.0.1).
At my work we are migrating a legacy Struts application to JSF/Seam slowly and don't have the luxuory of using all the latest stuff like EJB3 and JPA.
But we are really happy with JSF/Seam with Pojos, so many nice things in Seam besides JPA and EJB3.If you run into configuration problems, just post.
Cheers,
micke -
6. Re: The logical difference between a Bean and an Action?
sjmenden Aug 19, 2008 5:56 PM (in response to compiledmonkey)Going from an ear build.xml to a war build.xml is not easy, the best approach would be to rerun seam-gen and select war build instead of ear.
-
7. Re: The logical difference between a Bean and an Action?
sjmenden Aug 19, 2008 5:57 PM (in response to compiledmonkey)I meant to reply to this thread, hit the wrong reply :)
-
8. Re: The logical difference between a Bean and an Action?
sjmenden Aug 19, 2008 5:58 PM (in response to compiledmonkey)Ah forget it, the threading isn't what I expected anyways, ignore this and my previous post
-
9. Re: The logical difference between a Bean and an Action?
compiledmonkey Aug 19, 2008 6:16 PM (in response to compiledmonkey)I can't say I'm a complete fan of it either. How does the Maven structure look?
-
10. Re: The logical difference between a Bean and an Action?
mail.micke Aug 19, 2008 8:48 PM (in response to compiledmonkey)Have a look here maven2 directory layout.
And it just works when I do a
mvn eclipse:eclipse
it generates a nice eclipse project which I just import into my workspace.
Only thing is that I don't think I can get all the features from the JBoss Tools plugin using this structure, think it expects stuff to be in the action and model directories. But that will hopefully change soon.
-
11. Re: The logical difference between a Bean and an Action?
gjeudy Aug 19, 2008 10:01 PM (in response to compiledmonkey)Just to add on my original post, what I meant by java bean I meant plain pojos. Now I'm sorry I can't help you on how to migrate from ear to war app, your best bet is to generate with seam-gen and war option I guess, though I never used this myself.