biblio primefaces : faire apparaître et disparaître des composants
salut,
j'ai un code de test utilisant jsf et la bibliothèque primefaces, extensin de jsf.
je voudrais faire apparaître et disparaître des composants comme là : http://www.primefaces.org/showcase/u...leteSelect.jsf, j'ai posté une demande sur ce sujet ici : http://primefaces.prime.com.tr/forum...d3e88f9fe1c3e6,
en fait je ne voudrais pas qu'une nouvelle fenêtre soit ajoutée mais que les nouveaux composants soient affichés dans la page web de départ.
voici mon (court) code :
index.html
*************
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
|
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Facelet Title</title>
<h:outputScript name="jsf.js" library="javax.faces" target="head"/>
</h:head>
<h:body>
<f:view>
<h:form id="form0">
Hello from Facelets<br/>
<table>
<tr>
<td>
<p:autoComplete id="acp1" value="#{myBean.name}"
completeMethod="#{myBean.complete}"
selectListener="#{myBean.changeZipCode}"
>
</p:autoComplete>
</td>
<td>
<h:inputText id="theZipCode" value="#{myBean.zipCode}"
rendered="#{not empty myBean.zipCode}"/>
</td>
</tr>
</table>
</h:form>
</f:view>
</h:body>
</html> |
et MyBean.java
*******************
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
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package code;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
/**
*
* @author lolveley
*/
@ManagedBean
public class MyBean {
public MyBean() {
}
private String name;
private String zipCode=null;
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> complete(String query){
ArrayList<String> liste=new ArrayList<String>();
liste.add("Paris");
liste.add("Londres");
liste.add("New-York");
return liste;
}
public void changeZipCode(){
zipCode="57140";
}
} |
si vous pouvez m'aider, merci!
olivier.