helloworld:web:java:taglib:jsp
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
helloworld:web:java:taglib:jsp [2015/08/13 18:59] – Nettoyage root | helloworld:web:java:taglib:jsp [2020/05/10 23:57] (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]]. | + | Nécessite un projet de type [[ide:eclipse:projet|Dynamic Web Project]]. |
+ | =====Cas général===== | ||
<file xml tagperso.tld> | <file xml tagperso.tld> | ||
<?xml version=" | <?xml version=" | ||
Ligne 24: | Ligne 25: | ||
</ | </ | ||
</ | </ | ||
- | <note>'' | + | |
+ | <WRAP center round info 60%> | ||
+ | '' | ||
+ | </WRAP> | ||
<file java TagPerso.java> | <file java TagPerso.java> | ||
package com.llgc; | package com.llgc; | ||
Ligne 119: | Ligne 124: | ||
Le corps du message : Corps. | Le corps du message : Corps. | ||
</ | </ | ||
+ | |||
+ | =====Ajout d'un validateur des attributs===== | ||
+ | La méthode '' | ||
+ | |||
+ | <file java TagPersoExtra.java> | ||
+ | package com.llgc; | ||
+ | |||
+ | import java.util.Enumeration; | ||
+ | |||
+ | import javax.servlet.jsp.tagext.TagData; | ||
+ | import javax.servlet.jsp.tagext.TagExtraInfo; | ||
+ | |||
+ | public class TagPersoExtra extends TagExtraInfo | ||
+ | { | ||
+ | @Override | ||
+ | public boolean isValid (TagData tagData) | ||
+ | { | ||
+ | Enumeration < | ||
+ | System.out.println (" | ||
+ | while (attr.hasMoreElements ()) | ||
+ | { | ||
+ | String it = attr.nextElement (); | ||
+ | if (it.equals (" | ||
+ | { | ||
+ | return false; | ||
+ | } | ||
+ | System.out.println (it + " : " + tagData.getAttributeString (it)); | ||
+ | } | ||
+ | return super.isValid (tagData); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <file xml tagperso.tld> | ||
+ | <?xml version=" | ||
+ | < | ||
+ | xmlns: | ||
+ | xsi: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | … | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | Dans mon cas, pour que les modifications dans TagPersoExtra soient prises en compte, à chaque fois, il fallait que je réenregistre la page '' | ||
+ | </ | ||
+ | |||
+ | Rendu (si '' | ||
+ | {{: |
helloworld/web/java/taglib/jsp.1439485149.txt.gz · Dernière modification : 2015/08/13 18:59 de root