Problème sur ActionListener
Bonjour messieurs j'ai un problème sur ma page jsp.
j'ai une page ou je veux faire appel a une méthode a l’événement onselect de ma combo et elle se comporte bizarrement,le problème est que la méthode ne s'exécute que lorsque l'utilise fait l'upload de fichier pourtant ma première combobox doit pouvoir charger une deuxième sans que je ne fasse d'action ailleurs (notamment l'upload de fichier) quelqu'un pour m'aider je suis en jsf.
La partie de ma page jsp ou il y'a le bloc de l'upload et les combo en question:
Code:
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 53 54 55 56 57 58 59
| <td align="left" width="40%" valign="top">
<table align="center" border="0" cellspacing="2" cellpadding="2">
<tr>
<td valign="top"><br/>
<rich:panel id="photopanel" header="Selection photo du commerce">
<h:panelGroup >
<rich:message for="file" style="font-style=bold;font-color=Red;background-color:#ffffff"/>
</h:panelGroup>
<h:panelGrid columns="2" cellpadding="2" cellspacing="2">
<h:outputLabel for="file" value="Selectionnez une image ..." />
<t:inputFileUpload id="file" value="#{acquisitionBean.uploadedFile}" />
<h:outputText/>
<h:inputText id="im" value="#{acquisitionBean.fileName}"/>
<h:outputText/>
<h:commandButton id="btt"
value="Charger ..."
onclick="if(!check_photo()) return false"
actionListener="#{acquisitionBean.submit}">
<a4j:support event="onclick" reRender="im,img"/>
</h:commandButton>
<h:outputText/>
<a4j:mediaOutput element="img" cacheable="false" session="true"
createContent="#{acquisitionBean.paintFlash}" mimeType="image/jpeg" style="width:100px;heigth:100px" />
</h:panelGrid><br/>
<h:message for="btt" infoStyle="color: green;" errorStyle="color: red;" />
</rich:panel>
</td>
</tr>
</table></td>
<td align="right" width="30%" valign="top">
<table align="center">
<tr>
<td align="right" valign="top"><br/>
<rich:panel id="assurancespanel" header="Assurances">
<h:panelGrid columns="2" cellpadding="2" cellspacing="2">
<h:outputText value="Police d'assurance"/>
<rich:comboBox id="categories" value="#{acquisitionBean.selected.libelle_cat}"
suggestionValues="#{acquisitionBean.list_categorie}"
selectFirstOnUpdate="false"
defaultLabel="Selectionnez categorie..."
immediate="true"
directInputSuggestions="true">
<a4j:support reRender="sous_categories,montants" event="onselect" actionListener="#{acquisitionBean.doGetCategorie}"/>
</rich:comboBox>
<h:outputText value="Options"/>
<rich:comboBox id="sous_categories" value="#{acquisitionBean.sous_cat_selected.libelle_scat}"
suggestionValues="#{acquisitionBean.list_sous_categorie}"
defaultLabel="Selectionnez une sous categorie..."
directInputSuggestions="true">
</rich:comboBox>
<h:outputText value="Montant total"/>
<h:inputText id="montants" readonly="true" value="#{acquisitionBean.montant_com}"/>
<h:outputText value=""/>
<a4j:commandButton actionListener="#{acquisitionBean.ajouter_categorie}" reRender="montants,outputpanel" value="Ajouter"/>
</h:panelGrid>
</rich:panel>
</td>
</tr>
</table></td> |
et le code(methode de mon managedbean) ou je charge la seconde combo:
Code:
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
| public void doGetCategorie(ActionEvent event){
System.out.println("Dans la méthode dogetCategorie");
try{
String[] tab = selected.getLibelle_cat().split(" ");
Mysql Ms = new Mysql();
String Sql="SELECT * FROM sous_categories_assurances where id_cat="+Integer.parseInt(tab[0]);
ResultSet Rs = Ms.executeSelect(Sql);
// **************Initialiser les elts du formulaire ********
List_sous_categorie = new ArrayList<Clss_sous_categories>();
sous_cat_selected = new Clss_sous_categories();
//***********************************************************
while(Rs.next()){
sous_cat_selected.setId_cat(Rs.getInt("id_scat"));
sous_cat_selected.setLibelle_scat(Rs.getString("libelle_scat"));
sous_cat_selected.setMontant(Rs.getInt("montant"));
sous_cat_selected.setId_scat(Rs.getInt("id_cat"));
List_sous_categorie.add(sous_cat_selected);
sous_cat_selected = new Clss_sous_categories();
}
Ms.CloseMySql();
}
catch(Exception ex){
ex.printStackTrace();
}
} |
je rentres dans cette méthode que lorsque j'ai fait l'upload ce que je ne veux pas.