Bonjour,
Je tente de récupérer des valeurs de ma boîte de sélection selectOneMenu
pour l'instant j'en suis au stade d'essayer de faire fonctionner un exemple vu que je suis une bille en JSF, et la franchement je commence à craquer.
Avec trois bouquins sous le coude et google je rame encore ... .
J'avoue les vacances sont proches, même mes orteilles commencent à désirer du sable chaud .....blahblah ..;;
voila j'ai une pas belle page de test
j'utilise enfin j'essaye d'utiliser facelets ( comme smarty )
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 <span xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsf/core" xmlns:jstl="http://java.sun.com/jstl/core" > <ui:define name="geodetop"> <div id="geodetopbar"> <jstl:forEach var="liens" items="#{IHMManagedBean.moduleName}" > <span class="#{idonglet}"><a href="#{liens}.jsp">#{liens}</a></span> </jstl:forEach> </div> <div id="geodemiddlebar"> <c:subview> <h:form> <h:outputText value="Choisir une option"></h:outputText> <h:selectOneMenu id="selectMenu" valueChangeListener="#{IHMManagedBean.valueChange}" onchange="submit();" > <c:selectItems value="#{IHMManagedBean.modulesActions}"></c:selectItems> </h:selectOneMenu> </h:form> </c:subview> </div> <div id="addselect"></div> </ui:define> </span>
et donc le valueChangeListener="#{IHMManagedBean.valueChange}"
va chercher le
et tout fonctionne sauf ce
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
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 package com.org.geode.utils; import geode.main.MenuLeftGeodeLocal; import ihm.geode.Module; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.ejb.EJB; import javax.faces.component.UISelectOne; import javax.faces.context.FacesContext; import javax.faces.model.SelectItem; import javax.servlet.http.HttpServletRequest; public class IHMManagedBean { /** Creates a new instance of IHMManagedBean */ @EJB MenuLeftGeodeLocal menu; private List actions; private UISelectOne uiselectone; public IHMManagedBean() { actions = new ArrayList(); SelectItem option = new SelectItem("1","Création","true"); actions.add(option); option = new SelectItem("2","Modification"); actions.add(option); option = new SelectItem("3","Mise à jour"); actions.add(option); option = new SelectItem("4","Suppression"); actions.add(option); } /** * Récupération du titre de l'appli * @return */ public String getTitle(){ return menu.getTitle(); } public List<String> getMenu(){ return menu.getAction(); } public List<String> getModuleName(){ //System.out.println(getParamId("lienId")); Collection<String> liste = new ArrayList<String>(); for (Iterator<Module> it = menu.getModules().iterator(); it.hasNext();) { String string = it.next().getName(); liste.add(string); } return (List<String>) liste; } public List getModulesActions(){ return actions; } public Collection<Module> getModules(){ return menu.getModules(); } public String getUser(){ HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); String username = request.getRemoteUser(); return username; } public String getEvents(String essai){ return null; } public UISelectOne getUiselectone() { return uiselectone; } public void setUiselectone(UISelectOne uiselectone) { this.uiselectone = uiselectone; } public void valueChange(javax.faces.event.ActionEvent event){ String current = event.getComponent().getId(); System.out.println("Changement de valeur"); if (current !=null || !current.equals("")){ System.out.println(current); } } }
valueChange ...
j'ai activé les logs sous glassfish et la surprise
Il me dit que la méthode Identity 'IHMManagedBean' does not reference a MethodExpression instance, returned type ?????????????
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Injecting dependency with logical name com.org.geode.utils.IHMManagedBean/menu into field geode.main.MenuLeftGeodeLocal com.org.geode.utils.IHMManagedBean.menu on class class com.org.geode.utils.IHMManagedBean AbortProcessingException thrown when processing event of type 'javax.faces.event.ValueChangeEvent' during phase 'PROCESS_VALIDATIONS 3' for component with ID or Client ID of 'selectMenu' javax.faces.event.AbortProcessingException: /nav.jspx @16,113 valueChangeListener="#{IHMManagedBean}": Identity 'IHMManagedBean' does not reference a MethodExpression instance, returned type: com.org.geode.utils.IHMManagedBean javax.faces.event.AbortProcessingException: /nav.jspx @16,113 valueChangeListener="#{IHMManagedBean}": Identity 'IHMManagedBean' does not reference a MethodExpression instance, returned type: com.org.geode.utils.IHMManagedBean at javax.faces.event.MethodExpressionValueChangeListener.processValueChange(MethodExpressionValueChangeListener.java:82) at javax.faces.event.ValueChangeEvent.processListener(ValueChangeEvent.java:123) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:746) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:416)
bref j'ai essayé avec d'autres nom et dans ce cas la il ne trouve pas la méthode.
quelqu'un aurait un exemple simple mais complet, avec la jsp et le bean
pour tester, même juste un lien. car tout ce que je trouve c'est soit de la littérature incomplète soit des trucs vacheusement fort pour experts JSF top moumoute in english of course.
je, j'ai franchi JPA, relevé le défit des EJB3, mis à mal JMaki et facelets
et la ..........
olivier
"Une pensée pour mes enfants"
Partager