-
1. Re: problem with Stateless beans
pmuir Aug 20, 2007 4:56 PM (in response to nemya)Post your code.
-
2. Re: problem with Stateless beans
nemya Aug 21, 2007 3:35 AM (in response to nemya)***** 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
...
@Stateless
@Scope(ScopeType.STATELESS)
@Name("reportCongesCrossData")
public class reportCongesCrossDataBean implements reportCongesCrossData{
@Logger
private Log log;
@In
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() {
this.init();
}
public void init() {
remplirLignes();
remplirColonnes();
boiteNoire = CongeService.getCongePrisByTypeAbsence(lignes, colonnes);
}
...
} -
3. Re: problem with Stateless beans
pmuir Aug 21, 2007 5:09 AM (in response to nemya)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
nemya Aug 21, 2007 5:16 AM (in response to nemya)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
limousyf Aug 21, 2007 7:21 AM (in response to nemya)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 ...
Thanks -
6. Re: problem with Stateless beans
kosiakk Aug 24, 2007 8:13 PM (in response to nemya)Try @Create annotation
or, the easiest way, paste#{reportCongesCrossDataBean.init()}
somewhere in xhtml