1

hi i realise a j2ee application with jsf and jsf managed bean working well. but i have a technique question. all my managed bean are Viewscoped excepte the jsf managed bean of authentification . and i didnt implement serialization in my jsf managed bean.

is that gonna cause problem when many users gonna use my application ??

because i am afraid when i share my application in the main server i will face problems.

example of one of my jsf managed bean :

import java.util.ArrayList;
import java.util.Collection;
import java.util.List; 
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.application.ViewHandler;
import javax.faces.context.FacesContext;  
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import javax.faces.component.UIViewRoot;
import javax.persistence.EntityManager;
import managedbean.page.GestionDesPages;
import sessionbean.equipe.ManageEquipeLocal;
import sessionbean.utilisateur.ManageCompteProfilLocal;
import sessionbean.utilisateur.ManageCompteUtilisateurLocal;
import sessionbean.utilisateur.ManageProfilLocal;


@ManagedBean  
@ViewScoped 
public class GestiondesUtilisateurs implements Serializable{

     @EJB
     private ManageCompteProfilLocal manageCompteProfil;
     @EJB
     private ManageProfilLocal manageProfil;
     @EJB
     private ManageCompteUtilisateurLocal manageCompteUtilisateur;


     @ManagedProperty(value="#{gestionDesPages}")
     private GestionDesPages direction;

     private CompteUtilisateur usermodifiable ;
     private CompteUtilisateur newutilisateur = new CompteUtilisateur();

     @PostConstruct
     public void initialize() {
        tableusers = manageCompteUtilisateur.retournerUtilisateur();
        tablegroups = manageProfil.retournerProfil();
        Allprofil = manageProfil.retournerProfil();
        listofgroupsname(tablegroups);                              
      }

     public void listofgroupsname(List<Profil> list)
             {
                 for(int i=0;i<list.size();i++)
                 {
                     this.listofgroups.add(list.get(i).getType());
                 }
             }
}
user207421
  • 305,947
  • 44
  • 307
  • 483
marouanoviche
  • 253
  • 4
  • 11
  • 28
  • so when i add "implements Serializable" to my managed bean is enough to escape the problem ? – marouanoviche May 21 '13 at 14:48
  • Not necessarily, all fields need to be serializable to or be transient. Basic types often are but more complex objects might not be. I would advise you to find some material on serialization in Java. – Eelke May 22 '13 at 05:30

0 Answers0