Dans une application WEB en ADFBC + ADF +JSF , je souhaite créer un bouton pour lancer deux méthodes:
1) un execute sur ma view
2) un commit sur mon AppModule.
Merci de votre aide.
Dans une application WEB en ADFBC + ADF +JSF , je souhaite créer un bouton pour lancer deux méthodes:
1) un execute sur ma view
2) un commit sur mon AppModule.
Merci de votre aide.
Ca vaut le coup d'ajouter des réponses aidant les autres alors que tout le monde se la joue perso ??????
Je vais le faire quand meme ça évitera aux autres de se galérer comme je l'ai fait.
private UserSession user;
private BindingContainer bindings;
private PretsViewImpl prets;
private DossierViewImpl dossiers;
private CocontractantsViewImpl cocont;
public EditDossier() {
user=(UserSession)FacesContext.getCurrentInstance().getApplication().createValueBinding("#{user}").getValue(FacesContext.getCurrentInstance());
dossiers = user.getAm().getDossierView1();
prets = user.getAm().getPretsView2();
cocont = user.getAm().getCocontractantsView2();
Row rw=dossiers.getCurrentRow();
}
puis ....
public String nouveauPret_action() {
int index=0;
System.out.println("------- Nouveau Pret -------");
Row rw=dossiers.getCurrentRow();
String codeDossier= rw.getAttribute("CodeDossier").toString();
// Si la table cocontractant a des lignes
if (prets.getRowCount()>0) {
rw=prets.first();
do {
int thisidx=Integer.parseInt(rw.getAttribute("NumPret").toString());
if (thisidx>index) index=thisidx;
System.out.println("Index lu: "+thisidx+" retenu: " + index);
}while (prets.hasNext() && (rw=prets.next())!=null) ;
}
rw=prets.createRow();
System.out.println("Index créé: " + index);
rw.setAttribute("CodeDossier",codeDossier);
rw.setAttribute("NumPret",++index);
prets.insertRow(rw);
user.getAm().getTransaction().commit();
return "editPret";
}
Partager