6 Replies Latest reply on Aug 24, 2007 8:13 PM by Alexander Kosenkov

    problem with Stateless beans

    Aymen Newbie

      I need to have an xhtml page which uses an attribute in a stateless session bean. I want this attribute to be recalculated every time I call this page. I did this with the scope STATELESS. When I call the page it works well, but everytime I recall it(after I change some values concerning my attribute), the stateless sessin bean doesn't seem to be reinvoked. The page shows some old values. Is there a bug in the Seam I use (1.2.1 GA)? Or is there some annotations I have to add?
      Thank you

        • 2. Re: problem with Stateless beans
          Aymen Newbie

          ***** THE PAGE *****
          <h:form id="reportCongesCrossDataForm">
          <h:dataTable value="#{reportCongesCrossData.boiteNoire.lineDataModel}" var="lineSimple">

          ***** THE BEAN *****
          //I want the init() method to be executed every time I show the page


          public class reportCongesCrossDataBean implements reportCongesCrossData{

          private Log log;

          FacesMessages facesMessages;

          private List colonnes = new ArrayList();

          private List lignes = new ArrayList();

          TypeAbsenceList typeAbsenceList;

          CollaborateurList collaborateurList;

          private GenericCrossTable<Collaborateur, TypeAbsence, Float> boiteNoire=null;

          public reportCongesCrossDataBean() {


          public void init() {

          boiteNoire = CongeService.getCongePrisByTypeAbsence(lignes, colonnes);


          • 3. Re: problem with Stateless beans
            Pete Muir Master

            You need to read up on the contract using an SLSB gives you. It doesn't say a new bean will be created everytime you inject an instance.

            • 4. Re: problem with Stateless beans
              Aymen Newbie

              So what do I have to do to have a bean recreated or a method invoked every time I call the page?

              • 5. Re: problem with Stateless beans
                Francis LIMOUSY Newbie

                Ok, if we get it well :

                - to make an "old school request bean" => @Name (just a Seam object, in event scope)

                - to make an "old school session bean" => @Stateless (or just @Name and Scope(Session), but in this case I don't get the utility of @Stateless annotation)

                - to make a "new shiny stateful bean" => @Stateful

                Did I resume correctly the main usages of Seam beans compared to old jsf beans ?

                Please help poor noobish guys like us ...


                • 6. Re: problem with Stateless beans
                  Alexander Kosenkov Newbie

                  Try @Create annotation

                  or, the easiest way, paste


                  somewhere in xhtml