problem avec rich:picklist
salut tout le monde
voila mon problème après une semaine de galère viens de s'éclaircir :
je doit utiliser une picklist le problème c'est que les donnée de ma picklist ne sont pas statique et avant le choix dans une h:selectOneMenu la pick list est vide .. une foi la pick liste remplie j'ai le message d'erreur suivant.
Code:
1 2
| GRAVE: JSF1054: (Phase ID: PROCESS_VALIDATIONS 3, View ID: /welcomeJSF.jsp) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@84cc39]
GRAVE: Exception in the filter chain |
voila un petite exemple de code
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
| <%--
Document : newjsp
Created on : 30 juin 2009, 13:55:47
Author : beta
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<h:form>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>JSP Page</title>
</head>
<body>
<h:selectOneMenu id="raisonSocial" value="#{test.numContrat}" onchange="submit()" >
<f:selectItems value="#{SessionBean.raisonSocial}"/>
</h:selectOneMenu>
<rich:pickList value="#{test.a}">
<f:selectItems value="#{test.selection}"/>
</rich:pickList>
<rich:pickList value="#{test.b}">
<f:selectItems value="#{test.selection2}"/>
</rich:pickList>
<h:commandButton id="valider" value="valider" /> <h:commandButton id="annuler" value="annuler"/>
</body>
</html>
</h:form>
</f:view> |
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
| /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package beans;
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
/**
*
* @author beta
*/
public class test {
private List<SelectItem> selection = new ArrayList<SelectItem>();
private List<SelectItem> selection2 = new ArrayList<SelectItem>();
private List<String> a = new ArrayList<String>();
private List<String> b = new ArrayList<String>();
private String numContrat = "0";
public String getNumContrat() {
return numContrat;
}
public void setNumContrat(String numContrat) {
this.numContrat = numContrat;
}
public List<String> getB() {
return b;
}
public void setB(List<String> b) {
this.b = b;
}
public List<String> getA() {
return a;
}
public void setA(List<String> a) {
this.a = a;
}
public List<SelectItem> getSelection2() {
if (!numContrat.equalsIgnoreCase("")) {
selection2.clear();
for (int i = 0; i < 5; i++) {
selection2.add(new SelectItem(i, "test2" + i));
}
}
return selection2;
}
public void setSelection2(List<SelectItem> selection2) {
this.selection2 = selection2;
}
public List<SelectItem> getSelection() {
if (!numContrat.equalsIgnoreCase("")) {
selection.clear();
for (int i = 0; i < Integer.parseInt(numContrat); i++) {
selection.add(new SelectItem(i, "test" + i));
}
}
return selection;
}
public void setSelection(List<SelectItem> selection) {
this.selection = selection;
}
} |
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
| /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package beans;
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
/**/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package beans;
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
/**
*
* @author beta
*/
public class SessionBean {
private List<SelectItem> raisonSocial = new ArrayList<SelectItem>();
public List<SelectItem> getRaisonSocial() {
return raisonSocial;
}
public void setRaisonSocial(List<SelectItem> raisonSocial) {
this.raisonSocial = raisonSocial;
}
public void initRaisonSocial() {
for (int i = 0; i < 10; i++) {
raisonSocial.add(new SelectItem(i, "test" + i));
}
}
public SessionBean() {
initRaisonSocial();
}
}
*
* @author beta
*/
public class SessionBean {
private List<SelectItem> raisonSocial = new ArrayList<SelectItem>();
public List<SelectItem> getRaisonSocial() {
return raisonSocial;
}
public void setRaisonSocial(List<SelectItem> raisonSocial) {
this.raisonSocial = raisonSocial;
}
public void initRaisonSocial() {
for (int i = 0; i < 10; i++) {
raisonSocial.add(new SelectItem(i, "test" + i));
}
}
public SessionBean() {
initRaisonSocial();
}
} |
désolé je me suis trompé sur le code qui généré l'erreur .. cette foi ac beugue .. merci pour votre aide