Bonjour,
pour les besoin de mon application j'ai créé un formulaire qui est composé de 2 formulaires. L'idée étant que j'ai besoin d'un formulaire mélangeant les attributs de 2 tables de ma bdd, et que j'avais deja les formulaire associé a chacune de ses tables.
Donc en gros je veux utiliser tous les attributs de mes 2 formulaires via se formulaire.
Quand je veux sauvegarder/modifier mon form j'ai une classe adapté qui se charge de faire ça correctement.
Dans ma jsp je créé via <layout:datagrid> mon tableau, avec tout ce qu'il faut etc.. et pas de problème pour l'affichage : ça marche.
Les attributs dans mes champs select sont bien selectionné, tout correspond.
Mais dès que je cherche à enregistrer, que j'ai modifier/ajouter/supprimer ou non les données, j'ai une belle erreur de struts, et ne rentre même pas dans l'action qui traite ça.
Arrivant à afficher correctement, je me dis qu'il doit bien être possible de faire ce que j'essaie de faire, mais il doit me manquer quelque chose, une syntaxe particuliere peut-etre, je ne sais pas trop.
Je pourrais bien sur faire un Form qui reprend directement les attributs de mes 2 forms, mais cette solution m'énerve un peu.
Si quelqu'un peu m'aider à ce sujet...
Voici le message d'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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 ERROR [2008-08-21 15:34:29,125]: "Servlet.service()" pour la servlet action a généré une exception [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/opha].[action]] [invoke() 250] java.lang.IllegalArgumentException: No bean specified at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203) at com.francetelecom.clara.security.struts.action.SecuredRequestProcessor.process(SecuredRequestProcessor.java:165) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.teamlog.fwk.core.web.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Unknown Source)
Le code du formulaire dans ma jsp :
Mon Form principale :
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 <layout:form action="/objectifsPrevisionsVentesUpdate" reqCode="update" styleClass="FORM" bundle="ressourcesVide" width="800"> <layout:datagrid property="datagrid" selectionAllowed="true" multipleSelectionAllowed="false" styleClass="DATAGRID2" model="datagrid"> <layout:datagridText property="errGenerique" title="error.columnTitre"/> <layout:datagridCheckbox title="objectifsPrevisionsVentes.checked.libelle" property="checked" width="15"/> <layout:datagridSelect property="objectifsForm.refTypeAdvId" title="objectifsPrevisionsVentes.objectifs.refTypeAdv.libelle"> <layout:option value="-1" key="objectifsPrevisionsVentes.objectifs.refTypeAdv.select.libelle"></layout:option> <layout:options property="id" labelProperty="refTypAdvLib" collection="refTypeAdvForm" /> </layout:datagridSelect> <layout:datagridSelect property="objectifsForm.refSegmentId" title="objectifsPrevisionsVentes.objectifs.refSegment.libelle"> <layout:option value="-1" key="objectifsPrevisionsVentes.objectifs.refSegment.select.libelle"></layout:option> <layout:options property="id" labelProperty="segLib" collection="refSegmentForm" /> </layout:datagridSelect> <layout:datagridSelect property="previsionsVentesForm.preVteMois" title="objectifsPrevisionsVentes.previsionsVentes.mois.libelle"> <layout:option value="-1" key="objectifsPrevisionsVentes.previsionsVentes.mois.select.libelle"></layout:option> <layout:options collection="mois"/> </layout:datagridSelect> <layout:datagridSelect property="previsionsVentesForm.preVteAnnee" title="objectifsPrevisionsVentes.previsionsVentes.annee.libelle"> <layout:option value="-1" key="objectifsPrevisionsVentes.previsionsVentes.annee.select.libelle"></layout:option> <layout:options collection="annee"/> </layout:datagridSelect> <layout:datagridColumn title="objectifsPrevisionsVentes.previsionsVentes.prevision.libelle" property="previsionsVentesForm.preVteNbrVte"/> </layout:datagrid> <layout:row> <layout:button onclick="StrutsLayout.addDatagridLine('datagrid')"><bean:message key="bouton.ajouter"/></layout:button> <layout:button onclick="StrutsLayout.setDatagridLineState('datagrid', 'removed')"><bean:message key="bouton.supprimer"/></layout:button> <layout:submit onclick=""><bean:message key="bouton.enregistrer"/></layout:submit> <layout:button onclick="refresh()"><bean:message key="bouton.annuler"/></layout:button> </layout:row> </layout:form>
Merci à vous.
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 public class ObjectifsPrevisionsVentesForm extends BaseForm{ private String errGenerique; private boolean checked; private ObjectifsForm objectifsForm; private PrevisionsVentesForm previsionsVentesForm; public ObjectifsPrevisionsVentesForm() { super(); this.objectifsForm = new ObjectifsForm(); this.previsionsVentesForm = new PrevisionsVentesForm(); this.errGenerique = ""; this.checked = false; } public ObjectifsPrevisionsVentesForm(String errGenerique, boolean checked, ObjectifsForm objectifsForm, PrevisionsVentesForm previsionsVentesForm) { super(); this.errGenerique = errGenerique; this.checked = checked; this.objectifsForm = objectifsForm; this.previsionsVentesForm = previsionsVentesForm; } + getters/setters
Partager