01: package com.icesoft.faces.facelets;
02:
03: import com.sun.facelets.tag.TagDecorator;
04: import com.sun.facelets.tag.Tag;
05: import org.apache.commons.logging.Log;
06: import org.apache.commons.logging.LogFactory;
07:
08: /**
09: * 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(
31: "http://java.sun.com/JSP/")) {
32: log
33: .debug("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"
36: + tag);
37: }
38: }
39: return null;
40: }
41: }
|