slt,
je veux afficher libelle d'une fonction de personnel selon numéros de matricule d'un personnel numéro matricule(table agent) désignation fonction dans table fonction
voici mon code
aprés la création des dao
service fonction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public interface FonctionService {
public void createNew(Fonction instance);
public List<Fonction> findAll();
public void update(Fonction instance);
public void remove(Fonction instance);
public List<Fonction> findByEmployer(Integer matricule);
} |
fonctionimpl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| @Service("FonctionService")
public class FonctionServiceImpl implements FonctionService{
@Autowired
private FonctionDAO DAO;
@Autowired
public FonctionServiceImpl(FonctionDAO DAO) {
this.DAO = DAO;
}
@Transactional (readOnly=false)
public void createNew(Fonction instance) {
DAO.save(instance);
}
@Transactional(readOnly=true)
public List<Fonction> findAll() {
return DAO.findAll();
}
@Transactional
public void update(Fonction instance) {
DAO.merge(instance);
}
@Transactional
public void remove(Fonction instance) {
DAO.delete(instance);
}
@Transactional(readOnly=true)
public List<Fonction> readByCriteria(List<Criterion> criterion,List<Order> orders) {
return DAO.readByCriteria(criterion,orders);
}
public List<Fonction> findByEmployer(Integer matricule) {
List<Object> paramList=new ArrayList<Object>();
paramList.add(matricule);
return DAO.findByQuery("select * from fonction,agent where agent.IDT_MATAG=? and fonction.fon_code=agent.fon_code", paramList);
}
} |
bean FonctionBean
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| @Component("fonctionBean")
@Scope("session")
public class FonctionBean {
@Autowired
private FonctionService fonctionService;
private String fonDsg;
private List<Fonction> fonctions=new ArrayList<Fonction>();
public String initFonctionBean(){
UserBean userBean=(UserBean) JSFUtils.getExpressionValue("#{UserBean}");
fonctions.clear();
fonctions=fonctionService.findByEmployer(userBean.getUtilisateur().getIdtMatag());
return "fonctionsBean";
}
public List<Fonction> getFonctions() {
return fonctions;
}
public void setFonctions(List<Fonction> fonctions) {
this.fonctions = fonctions;
}
public String getfonDsg() {
return fonDsg;
}
public void setfonDsg(String fonDsg) {
this.fonDsg = fonDsg;
}
} |
page dans la page jsf
<h:outputText value="#{FonctionBean.fonDsg}"></h:outputText>
dans le face-config
1 2 3 4 5
| <managed-bean>
<managed-bean-name>fonctionBean</managed-bean-name>
<managed-bean-class>tn.com.portailRH.view.FonctionBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean> |
la fonction du personnel n'est pas afficher dans le outputtext
Partager