Problème de <s:select dans jquery.dialog.
Bonjour,
J'ai un problème à cause d'un select (struts2) dans un popup créé avec jquery...
Si je n'ai pas mon <s:select et que je valide mon popup formulaire, je suis redirigé correctement par contre si j'ai mon <s:select j'ai ce message d'erreur :
Code:
Etat HTTP 404 - No result defined for action *****.gestionBancaire.actions.ComptesParam and result input
Je ne comprends pas... Pouvez-vous m'aider, svp ? :ccool:
La config de mon projet :
Jquery UI 1.8.16 (min)
Jquery 1.6.2 (min)
Struts 2.1.8.1
sitemesh 2.4.2
display-tag 1.1.1
spring 2.5.6
Le code java :
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 60 61 62 63 64 65 66
|
private Map <Integer,String> listTypes;
private List <Integer> listTypesId;
...
// Méthode appelée si on ne spécifie pas une autre méthode
@Override
public String input(){
getTypeComptes();
listComptes = comptesService.findAll();
return SUCCESS;
}
// Méthode appelée pour l'ajout
public String ajout(){
//TODO Vérification bunisses si double en db
try {
comptesService.save(this.compteToAdd,false);
} catch (Exception e) {
listErrors.add(e.getMessage());
getTypeComptes();
listComptes = comptesService.findAll();
return ERROR;
}
getTypeComptes();
listComptes = comptesService.findAll();
return SUCCESS;
}
...
// *********** Méthodes internes ****************
private void getTypeComptes(){
listTypes = new HashMap<Integer, String>();
listTypesId = new ArrayList<Integer>();
List<Type> listType = typeService.findAll();
for (Type type : listType) {
listTypesId.add(type.getId());
listTypes.put(type.getId(), type.getLibelle());
}
}
...
public Map<Integer, String> getListTypes() {
return listTypes;
}
public List<Integer> getListTypesId() {
return listTypesId;
}
public void setListTypes(Map<Integer, String> listTypes) {
this.listTypes = listTypes;
}
public void setListTypesId(List<Integer> listTypesId) {
this.listTypesId = listTypesId;
} |
Le code de ma jsp :
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
|
<%-- POPUP D'AJOUT/MODIFICATION D'UN CODE DIVERS --%>
<div align="center" id="popup" style="display:none;" title="Ajout/Edition d'un compte">
<s:form id="formPopup" name ="formPopup" theme="simple" method="post">
<%-- VA CONTENIR LES MESSAGES D'ERREUR RETOURNES PAR JQUERY --%>
<div id="jQueryErrorPopup" style="align:center; display:none; max-width: 250px;" class="ui-state-error ui-corner-all"></div>
<table align="center">
<tr>
<td>Libellé</td>
<td><s:textfield id="popupLib" cssStyle="width: 240px; " maxlength="30"/></td>
</tr>
<tr>
<td>Multiplicateur</td>
<td><s:textfield id="popupMulti" cssStyle="width: 240px; " maxlength="30"/></td>
</tr>
<tr>
<td>Montant</td>
<td><s:textfield id="popupPlafond" cssStyle="width: 240px; " maxlength="30"/></td>
</tr>
<tr>
<td>Date de Début</td>
<td><s:textfield id="popupDateDebut" cssStyle="width: 240px; " maxlength="30"/></td>
</tr>
<tr>
<td>Type</td>
<td>
<s:select headerKey="-1"
headerValue="--------------- Select ---------------"
labelposition="center"
name="listTypesId"
list="listTypes"
id="listTypesId"
style="width:243px;">
</s:select>
</td>
</tr>
</table>
</s:form>
</div> |
et mon javascript :
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
| /**
* Gestion des événements
*/
$(document).ready(function(){
/* Popup de maj (ajout et édition). Mise en forme et action sur bouton*/
$("#popup").dialog({
autoOpen: false,
modal: true,
resizable: false,
width:400,
buttons: {
"Valider": function() {
viderErreur();
valideForm = true;
/* Validation des champs obligatoire */
if ($("#popupLib").val() ==""){
valideForm = false;
$("#jQueryErrorPopup").fadeIn().text("Le libellé du compte est obligatoire");
}
if (valideForm){
/* Ajout */
if ($("#operationPopup").val() == 'A'){
$("#compteToAddLib").val($("#popupLib").val());
$("#compteToAddMulti").val($("#popupMulti").val());
$("#compteToAddPlafond").val($("#popupPlafond").val());
$("#compteToAddDateDebut").val($("#popupDateDebut").val());
$("#compteToAddType").val($("#listTypesId").val());
$("#form_global").attr("action","/ComptesBancaires/compteParam!ajout.do");
$("#form_global").submit();
$(this).dialog("close");
}
/* Edition */
else {
$("#compteToUpdateId").val($("#compteOldId").val());
$("#compteToUpdateLib").val($("#popupLib").val());
$("#compteToUpdateMulti").val($("#popupMulti").val());
$("#compteToUpdatePlafond").val($("#popupPlafond").val());
$("#compteToUpdateType").val($("#listTypesId").val());
$("#form_global").attr("action","/ComptesBancaires/compteParam!edition.do");
$("#form_global").submit();
$(this).dialog("close");
}
}
},
"Annuler": function() {
viderErreur();
$(this).dialog("close");
}
}
});
/* Popup de suppresion. Mise en forme et action sur bouton */
$("#popupDelete").dialog({
autoOpen: false,
modal: true,
resizable: false,
width:300,
height:177,
buttons: {
"Oui": function() {
$("#form_global").attr("action","/ComptesBancaires/compteParam!delete.do");
$("#form_global").submit();
$(this).dialog("close");
},
"Non": function() {
$(this).dialog("close");
}
}
});
});
/* ********************************************************************************
* POPUP CODE DIVERS
* ********************************************************************************/
/**
* Permet d'exéctuer une action sur les codes divers.
*/
// edition et ajout
function popup(num,ope){
viderErreur();
$("#operationPopup").val(ope);
/* Edition */
if (ope == 'E'){
/* Save des anciennes valeurs */
$("#compteOldId").val($("#hiddenRowId"+num).val());
$("#popupLib").attr("value",$("#hiddenRowLib"+num).val());
$("#popupMulti").attr("value",$("#hiddenRowMulti"+num).val());
$("#popupPlafond").attr("value",$("#hiddenRowPlafond"+num).val());
$("#listTypesId").attr("value",$("#hiddenRowType"+num).val());
/* ici récupérer valeur pour les combobox */
}
/* Ajout */
else {
$("#popupNom").val("");
}
$("#popup").dialog("open");
}
function deletecompte(id){
viderErreur();
$("#compteOldId").val(id);
$("#popupDelete").dialog('open');
}
/* ********************************************************************************
* FONCTIONS DIVERSES
* ********************************************************************************/
/* Fonction relative à* la fenetre modale de confirmation pour faire un retour ou un quitter */
function viderErreur()
{
$('#jQueryErrorPopup').empty();
$('#jQueryErrorPopup').hide();
} |
struts.xml
Code:
1 2 3 4 5
|
<action name="compteParam" class="be.ferir.laurent.gestionBancaire.actions.ComptesParam" method="input" >
<result name="success">/WEB-INF/views/Comptes.jsp</result>
<result name="error" >/WEB-INF/views/Comptes.jsp</result>
</action> |
Comme vous voyez, on dirait que le fait d'avoir le select, me redirige avec ma method par défaut input... Plutot que de prendre ce que je lui passe comme action dans mon javascript... Je ne comprends pas...
Merci d'avance pour votre aide :ccool::ccool::ccool: