Bonjour,
j'utilise struts-layout, et je veux utiliser le suggest.
Mon pb est le suivant, c'est qd je charge ma page web, j'obtiens l'erreur suivante :
Je n'arrive pas à savoir à quoi correspond l'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 org.apache.jasper.JasperException: /vues/carnetAdresseTab/tabEntreprise.jsp(29,1) According to the TLD or the tag file, attribute property is mandatory for tag suggest at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:234) at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:693) at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:730) at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
Je me doute que c'est en rapport avec les instructions dans le trag suggest, mais qd je regarde la doc et l'exemple en ligne sur struts-layout, je ne vois pas où cela cloche.org.apache.jasper.JasperException: /vues/carnetAdresseTab/tabEntreprise.jsp(29,1) According to the TLD or the tag file, attribute property is mandatory for tag suggest
voici mon code :
Ma classe action dérivé de SuggestAction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 package drdict.struts.action; import java.util.*; import javax.servlet.http.HttpServletRequest; import drdict.ejb.interfaces.CommuneInterface; import drdict.util.Locator; import fr.improve.struts.taglib.layout.suggest.SuggestAction; public class VilleSuggestAction extends SuggestAction { private Locator locator = new Locator(); private CommuneInterface cI = null; @Override public Collection getSuggestionList(HttpServletRequest request, String mot) { // init des variables cI = locator.InitCommuneInterface(cI); List listVille = cI.listCommune(); // Start to build the suggestions list ArrayList suggestions = new ArrayList(); if (mot != null && mot.length() > 0) { listVille.iterator(); Iterator iter = listVille.iterator(); while(iter.hasNext()) { String currentWord = (String) iter.next(); if(currentWord.toLowerCase().startsWith(mot.toLowerCase())) suggestions.add(currentWord); } } return suggestions; } }
ma déclaration dans mon struts-config.xml :
et enfin, le code de ma page jsp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 <!-- DEBUT page du carnet d'adresse --> <action path="/carnetAdresse" type="drdict.struts.action.CarnetAdresseAction" name="carnetAdresseBean" scope="session" validate="false" parameter="reqCode" attribute="carnetAdresseBean"> <forward name="carnetAdresse" path="page.carnetAdresse" /> <forward name="accueil" path="/accueil.do?reqCode=droitKo" /> </action> <action path="/getVilleSuggestions" type="drdict.struts.action.VilleSuggestAction"> </action>
Mon code jsp se trouve encadré par un form
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %> <script language="javascript" type="text/javascript"> function effacer(){ with(document.carnetAdresseBean){ entrepriseNom.value=""; entrepriseAdresse.value=""; entrepriseVille.value=""; entrepriseCodePostal.value=""; entrepriseTelephone.value=""; entrepriseFax.value=""; entrepriseExpediteurDestinataire[0].checked=true; } } </script> <layout:panel styleClass="FORM" key="carnet.adresse.tab.entreprise.titre" width="700" align="center"> <layout:select key="" property="entrepriseNomSelect" styleClass="LABEL" tabindex="1"> <layout:options collection="entrepriseListeNom" property="id" labelProperty="nom"/> </layout:select> <layout:text key="carnet.adresse.tab.entreprise.nom" property="entrepriseNom" styleClass="LABEL" cols="50" isRequired="true" tabindex="2"/> <layout:text key="carnet.adresse.tab.entreprise.adresse" property="entrepriseAdresse" styleClass="LABEL" cols="50" isRequired="true" tabindex="3"/> <layout:text key="carnet.adresse.tab.entreprise.ville" property="entrepriseVille" styleClass="LABEL" cols="50" isRequired="true" tabindex="4"/> <layout:suggest suggestAction="/getVilleSuggestions" key="entrepriseVille" suggestCount="20" /> <layout:text key="carnet.adresse.tab.entreprise.code.postal" property="entrepriseCodePostal" styleClass="LABEL" cols="50" readonly="true" styleId="entrepriseCodePostal"/> <layout:text key="carnet.adresse.tab.entreprise.telephone" property="entrepriseTelephone" styleClass="LABEL" cols="50" isRequired="true" tabindex="5"/> <layout:text key="carnet.adresse.tab.entreprise.fax" property="entrepriseFax" styleClass="LABEL" cols="50" tabindex="6"/> <layout:radios key="" property="entrepriseExpediteurDestinataire" styleClass="LABEL"> <layout:options collection="entrepriseListExpediteurDestinataire" property="id" labelProperty="nom"/> </layout:radios> <layout:row> <layout:submit reqCode="saveEntreprise"> <bean:message key="carnet.adresse.tab.entreprise.sauver" /> </layout:submit> <layout:button onclick="effacer()"> <bean:message key="carnet.adresse.tab.entreprise.effacer" /> </layout:button> <layout:submit reqCode="deleteEntreprise"> <bean:message key="carnet.adresse.tab.entreprise.supprimer" /> </layout:submit> </layout:row> </layout:panel>
Voilà, donc si vous avez des idées pour corriger mon pb, je suis preneur
Partager