I agree with the fact the "traditional" way of doing things is hard ot get
rid of, I agree with Pete too, but if I may, I'd say it's often hard or
impossible to avoid some "view bean".
You can, when you only want to display stuff that doesn't need any 'UI'
Otoh, take a canonical CRUD: the submit button requires an action method
you don't have in your business layer. So it must go on a bean standing
behind the view.
Another example: feed a table on the screen. If the objects fetched from
the business layer can be displayed as-is, you can directly call the EJB.
But many developers will be reluctant to annotate it @Named. So you have to
wire your business methods through a view bean which is known to EL. Now,
if the elements on the table require any manipulation/action, you have to
encapsulate them and there's no other way but to get the cooking done on
some view bean.
And as development teams are required to work in a "normalized" way no
matter what's going to be on the screen, you end up having complete web
applications wiring all the biz methods through view beans.
After all I see no probmem with that, with CDI everyone can work the way he
wants. In my application I get all the db/xml configs via producer methods,
and I did a custom scope/context to refresh them without restarting
anything. So no matter whether you want to do simple of sophisticated
things, CDI has a solution in store.
On Thu, Dec 22, 2011 at 2:06 PM, Peter Muir <pmuir(a)redhat.com> wrote:
IMO both approaches are valid in different situations, and it
depends on the app. If I have multiple view layers (eg jsf and jax rs I
will likely want some sort of controller bean betweeny business layer and
jsf, so as to not let jsf concerns leak. Otoh if it was just a web app with
a jsf front end only, maybe I would dispose of this layer.
On 22 Dec 2011, at 11:36, "John D. Ament" <john.d.ament(a)gmail.com>
I tried this a few times recently. the main issue that pops up is that
the EJB timeouts and WEB timeouts in the platform do not sync up. so if
you're idle on a page for 5 minutes, your stateful EJB disappears, unless
you have someone change container config.
On Thu, Dec 22, 2011 at 5:49 AM, José Rodolfo Freitas <
> CDI created the possibility to reach any bean in the container from a JSF
> view, encouraging a closer approach between ejb and jsf (or any cdi bean
> and jsf), which can potentially lead to a simpler application design. I
> think that is great!
> However, I'm observing that this new programming model has been
> experimenting user resistance. The "traditional" way of doing things,
> a "ViewBean" accessing a Stateless Service seems to be the
> more legit.
> What do you think about this? I'd like to discuss best practices around
> it as I see it's on the core of almost every web application design.
> seam-dev mailing list
cdi-dev mailing list
cdi-dev mailing list