helloworld:web:java:taglib:jsp
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:jsp [2015/08/13 11:21] – Création 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=" | ||
- | <j2ee:taglib version=" | + | <javaee:taglib version=" |
xmlns: | xmlns: | ||
- | xsi: | + | xsi: |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | <j2ee:tag> | + | <javaee:tag> |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | </j2ee: | + | </javaee: |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | <j2ee: | + | <javaee: |
- | </j2ee: | + | </javaee: |
- | </j2ee:tag> | + | </javaee:tag> |
- | </j2ee:taglib> | + | </javaee:taglib> |
</ | </ | ||
- | <note>'' | + | |
+ | <WRAP center round info 60%> | ||
+ | '' | ||
+ | </WRAP> | ||
<file java TagPerso.java> | <file java TagPerso.java> | ||
package com.llgc; | package com.llgc; | ||
Ligne 97: | Ligne 102: | ||
<file xml taglib.jsp> | <file xml taglib.jsp> | ||
<%@ page language=" | <%@ page language=" | ||
- | pageEncoding=" | + | pageEncoding=" |
- | import=" | + | |
<%@ taglib uri=" | <%@ taglib uri=" | ||
Ligne 120: | 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.1439457705.txt.gz · Dernière modification : 2015/08/13 11:21 de root