[html:img] comment ca marche?
Bonjour!
Je veux, au clic sur une image, ouvrir une popup affichant des infos.
J'ai une arraylist d'objets AvisBean que j'affiche dans ma jsp.
Code AvisBean.java
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
private String nomOffre;
private String avis;
private String[] informations;
private String[] motifs;
/*getters & setters (pour chacun des attributs : nomoffre, ..., motifs*/
public porpType getBLABLABLA(){...}
public void setBLABLABLA(String prop){...}
/* getters & setters supplémentaires (pour utilisation jsp)*/
public void setInformationsToString(String[] infos){}
public String getInformationsToString(){
String infostoString="";
for(int i=0; i<informations.length){
infostoString.concat(";");
infostoString.concat(informations[i]);
}
return infostoString;
} |
Dans ma jsp, j'affiche une liste d'AvisBean :
Code:
1 2 3 4 5 6 7 8 9
|
<logic:iterate id="avis" name="nomDuFormOuEstStockeeListeAvis">
<bean:write name="avis" property="nomOffre"/>
<bean:write name="avis" property="avis"/>
<html:img onclick="ouvrirPopupInfos()" paramId="infos" paramName="avis" paramProperty="informationsToString" srcKey="urlImagePlusInfo"/>
<logic:iterate id="motif" name="avis" property="motifs">
<bean:write name="motif"/>
</logic:iterate>
</logic:iterate> |
La fonction js appelée est la suivante :
Code:
1 2 3 4
|
function ouvrirPopupInfos(){
window.open("/actionPlusInfos.do", "titre popup", "resizable=no");
} |
Le passage en gras (html:img...), je l'ai mis car je pensais qu'en faisant cela, lorsque je passerais dans l'Action associée à /actionPlusInfos.do, je pourrais récupérer le paramètre infos initialisé avec la valeur informationsToString de l'avis correspondant au bouton image cliqué...
Apparemment ca ne marche pas...
Vous voyez ou est l'erreur?
solution un peu pas top...mais ca marche :)
Alors, voila, j'ai fait un truc pas tout à fait top, mais bon, vu que ca marche....
Code:
1 2 3 4
| <bean:define id="infosString" name="avis" property="informationsToString"/>
<a href="#" onclick='ouvrirPopupInfos("${infosString}")'>
<html:img srcKey="keyurlImg" border="0" altKey="textAltKey"/>
</a> |
j'ai essayé de faire la même chose en utilisant le tag html:link censé remplacer le tag a href... mais ca marche pas.... Et une journée entière juste pour ouvrir une popup, ca fait beaucoup trop lol... Alors j'ai laissé comme ca.... :)
En tout ca merci à tous pour votre aide :)