3 Replies Latest reply on Nov 23, 2009 6:48 PM by Fabio Montezuma

    Injection fail, design problems

    Fabio Montezuma Newbie


      I have an action bean that is getting too big because its page has some tricky manipulations.

      Trying to divide this bean, I created a property in it called events that instantiate another class called here ActionEvents (to manipulate form fields events).

      I have something like this:

      public class Action {
         private EntityManager entityManager;
         private ActionEvents events;
         public Action() {
            this.events = new ActionEvents(this);
         // other methods   
         // getters and setters

      public class ActionEvents {
         private Action action;
         public ActionEvents(Action action) {
            this.action = action;
         public void select_onclick()

      And the page:

      <h:selectOneRadio id="select">
         <s:selectItems ...>
         <a:support event="onclick" actionListener="#{action.events.select_onclick}" />

      But when methodA is called inside select-onclick() the entityManager is null.

      Howto solve this? Does this design looks too bad?

      Thanks in advance!