helloworld:web:java:taglib:jsf
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| helloworld:web:java:taglib:jsf [2015/08/13 22:56] – Création root | helloworld:web:java:taglib:jsf [2020/05/10 23:56] (Version actuelle) – Suppression de la taille par défaut pour les images root | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | Nécessite un projet de type [[eclipse:howto:dwp|Dynamic Web Project]] avec les '' | + | Nécessite un projet de type [[ide:eclipse:projet|Dynamic Web Project]] avec les '' |
| - | + | ||
| - | <file xml faces-config.xml> | + | |
| - | <?xml version=" | + | |
| - | < | + | |
| - | xmlns: | + | |
| - | xsi: | + | |
| - | version=" | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | <file java TagHeure.java> | + | |
| - | package com.llgc; | + | |
| - | + | ||
| - | import javax.faces.component.UIComponent; | + | |
| - | import javax.faces.webapp.UIComponentELTag; | + | |
| - | + | ||
| - | // Le nom de cette classe correspond avec celui défini dans le fichier tld, rubrique tag-class. | + | |
| - | public class TagHeure extends UIComponentELTag | + | |
| - | { | + | |
| - | private String label; | + | |
| - | + | ||
| - | public String getLabel () | + | |
| - | { | + | |
| - | return label; | + | |
| - | } | + | |
| - | + | ||
| - | public void setLabel (String label) | + | |
| - | { | + | |
| - | this.label = label; | + | |
| - | } | + | |
| - | + | ||
| - | @Override | + | |
| - | public String getComponentType () | + | |
| - | { | + | |
| - | // Le nom du type du composant correspond avec celui défini dans le fichier faces-config.xml, | + | |
| - | // rubrique component|component-type | + | |
| - | return " | + | |
| - | } | + | |
| - | + | ||
| - | @Override | + | |
| - | public String getRendererType () | + | |
| - | { | + | |
| - | // Le nom du rendu du composant correspond avec celui défini dans le fichier faces-config.xml, | + | |
| - | // rubrique render-kit|renderer|renderer-type | + | |
| - | return " | + | |
| - | } | + | |
| - | + | ||
| - | @Override | + | |
| - | protected void setProperties (UIComponent composant) | + | |
| - | { | + | |
| - | composant.getAttributes().put(" | + | |
| - | super.setProperties (composant); | + | |
| - | } | + | |
| - | + | ||
| - | } | + | |
| - | </ | + | |
| + | =====component + renderer===== | ||
| <file java TagHeureRenderer.java> | <file java TagHeureRenderer.java> | ||
| package com.llgc; | package com.llgc; | ||
| Ligne 82: | Ligne 13: | ||
| import javax.faces.render.Renderer; | import javax.faces.render.Renderer; | ||
| + | @FacesRenderer (componentFamily=" | ||
| public class TagHeureRenderer extends Renderer | public class TagHeureRenderer extends Renderer | ||
| { | { | ||
| Ligne 108: | Ligne 40: | ||
| import javax.faces.context.ResponseWriter; | import javax.faces.context.ResponseWriter; | ||
| + | @FacesComponent (" | ||
| public class TagHeureHtml extends HtmlOutputText | public class TagHeureHtml extends HtmlOutputText | ||
| { | { | ||
| Ligne 114: | Ligne 47: | ||
| public String getFamily () | public String getFamily () | ||
| { | { | ||
| - | // Le nom du rendu du composant correspond avec celui défini dans le fichier faces-config.xml, | + | |
| - | // rubrique render-kit|renderer|component-family | + | return "com.llgc.heureCourante"; |
| - | return " | + | |
| } | } | ||
| Ligne 123: | Ligne 55: | ||
| { | { | ||
| ResponseWriter out = context.getResponseWriter (); | ResponseWriter out = context.getResponseWriter (); | ||
| - | out.write ("</ | + | out.write ("<br />" |
| super.encodeEnd (context); | super.encodeEnd (context); | ||
| } | } | ||
| Ligne 137: | Ligne 69: | ||
| < | < | ||
| < | < | ||
| - | < | + | < |
| </ | </ | ||
| </ | </ | ||
| Ligne 152: | Ligne 84: | ||
| < | < | ||
| < | < | ||
| - | < | + | < |
| - | < | + | < |
| </ | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| </ | </ | ||
| </ | </ | ||
| Ligne 172: | Ligne 108: | ||
| </ | </ | ||
| < | < | ||
| - | | + | < |
| - | | + | |
| - | </p> | + | |
| </ | </ | ||
| </ | </ | ||
| Ligne 181: | Ligne 115: | ||
| Rendu : | Rendu : | ||
| - | {{: | + | {{: |
| + | |||
| + | =====Source XHTML===== | ||
| + | Volé (et actualisé) depuis [[http:// | ||
| + | |||
| + | <file xml taglibsource.xhtml> | ||
| + | <?xml version=" | ||
| + | < | ||
| + | <html xmlns=" | ||
| + | xmlns: | ||
| + | xmlns: | ||
| + | xmlns: | ||
| + | < | ||
| + | < | ||
| + | <table border=" | ||
| + | <tr bgcolor=" | ||
| + | < | ||
| + | <font color=" | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <file xml tagheure2.taglib.xml> | ||
| + | <?xml version=" | ||
| + | < | ||
| + | xmlns: | ||
| + | xmlns: | ||
| + | xsi: | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <file xml web.xml> | ||
| + | <?xml version=" | ||
| + | <web-app xmlns: | ||
| + | xmlns=" | ||
| + | xsi: | ||
| + | version=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <WRAP center round info 60%> | ||
| + | Il est possible de spécifier plusieurs '' | ||
| + | </ | ||
| + | |||
| + | <file xml taglib2.xhtml> | ||
| + | <?xml version=" | ||
| + | < | ||
| + | <html xmlns=" | ||
| + | xmlns: | ||
| + | xmlns: | ||
| + | xmlns: | ||
| + | xmlns: | ||
| + | < | ||
| + | <meta http-equiv=" | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | Rendu : | ||
| + | {{: | ||
| + | |||
| + | =====Ajout d'un validateur des attributs===== | ||
| + | En '' | ||
| + | |||
| + | La seule solution que j'ai trouvé pour avoir un comportement similaire à '' | ||
helloworld/web/java/taglib/jsf.1439499387.txt.gz · Dernière modification : de root
