KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icesoft > faces > facelets > JspTagDetector


1 package com.icesoft.faces.facelets;
2
3 import com.sun.facelets.tag.TagDecorator;
4 import com.sun.facelets.tag.Tag;
5 import org.apache.commons.logging.Log;
6 import org.apache.commons.logging.LogFactory;
7
8 /**
9  * When people are converting from JSP to Facelets, they can
10  * forget that they can't use JSP tags, and get confused as
11  * to why things aren't working. This will give detect JSP
12  * tags and log a debug message.
13  *
14  * @author Mark Collette
15  * @since 1.6
16  */

17 public class JspTagDetector implements TagDecorator {
18     private static Log log = LogFactory.getLog(TagDecorator.class);
19     
20     public JspTagDetector() {
21         super();
22     }
23     
24     /**
25      * @see TagDecorator#decorate(com.sun.facelets.tag.Tag)
26      */

27     public Tag decorate(Tag tag) {
28         if( log.isDebugEnabled() ) {
29             if( tag.getNamespace() != null &&
30                 tag.getNamespace().startsWith("http://java.sun.com/JSP/") )
31             {
32                 log.debug(
33                     "A JSP tag has been detected in your Facelets page. "+
34                     "Facelets is an alternative to JSP, so it is not valid " +
35                     "to use JSP tags or directives here. The JSP tag:\n" + tag);
36             }
37         }
38         return null;
39     }
40 }
41
Popular Tags