You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/07/24 03:17:35 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java
luehe 2003/07/23 18:17:34
Modified: jasper2/src/share/org/apache/jasper/compiler
TagLibraryInfoImpl.java
Log:
Do not unconditionally use "JSP" as the default body-content type,
because it is illegal for SimpleTag handlers
Revision Changes Path
1.43 +45 -26 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
Index: TagLibraryInfoImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- TagLibraryInfoImpl.java 21 May 2003 18:09:33 -0000 1.42
+++ TagLibraryInfoImpl.java 24 Jul 2003 01:17:33 -0000 1.43
@@ -367,10 +367,10 @@
}
private TagInfo createTagInfo(TreeNode elem) throws JasperException {
- String name = null;
- String tagclass = null;
- String teiclass = null;
- String bodycontent = "JSP"; // Default body content is JSP
+ String tagName = null;
+ String tagClassName = null;
+ String teiClassName = null;
+ String bodycontent = null;
String info = null;
String displayName = null;
String smallIcon = null;
@@ -385,13 +385,13 @@
String tname = element.getName();
if ("name".equals(tname)) {
- name = element.getBody();
+ tagName = element.getBody();
} else if ("tagclass".equals(tname) ||
"tag-class".equals(tname)) {
- tagclass = element.getBody();
+ tagClassName = element.getBody();
} else if ("teiclass".equals(tname) ||
"tei-class".equals(tname)) {
- teiclass = element.getBody();
+ teiClassName = element.getBody();
} else if ("bodycontent".equals(tname) ||
"body-content".equals(tname)) {
bodycontent = element.getBody();
@@ -422,32 +422,51 @@
}
}
- TagAttributeInfo[] tagAttributeInfo
- = new TagAttributeInfo[attributeVector.size()];
- attributeVector.copyInto(tagAttributeInfo);
-
- TagVariableInfo[] tagVariableInfos
- = new TagVariableInfo[variableVector.size()];
- variableVector.copyInto(tagVariableInfos);
+ // Determine appropriate default value for body-content
+ if (bodycontent == null) {
+ try {
+ Class tagClass = ctxt.getClassLoader().loadClass(tagClassName);
+ if (SimpleTag.class.isAssignableFrom(tagClass)) {
+ bodycontent = TagInfo.BODY_CONTENT_SCRIPTLESS;
+ } else {
+ bodycontent = TagInfo.BODY_CONTENT_JSP;
+ }
+ } catch (Exception e) {
+ err.jspError("jsp.error.loadclass.taghandler", tagClassName,
+ tagName);
+ }
+ }
TagExtraInfo tei = null;
- if (teiclass != null && !teiclass.equals("")) {
+ if (teiClassName != null && !teiClassName.equals("")) {
try {
- Class teiClass = ctxt.getClassLoader().loadClass(teiclass);
+ Class teiClass = ctxt.getClassLoader().loadClass(teiClassName);
tei = (TagExtraInfo) teiClass.newInstance();
} catch (Exception e) {
- err.jspError("jsp.error.teiclass.instantiation", teiclass, e);
+ err.jspError("jsp.error.teiclass.instantiation", teiClassName,
+ e);
}
}
- TagInfo taginfo = new TagInfo(name, tagclass, bodycontent,
- info, this,
+ TagAttributeInfo[] tagAttributeInfo
+ = new TagAttributeInfo[attributeVector.size()];
+ attributeVector.copyInto(tagAttributeInfo);
+
+ TagVariableInfo[] tagVariableInfos
+ = new TagVariableInfo[variableVector.size()];
+ variableVector.copyInto(tagVariableInfos);
+
+ TagInfo taginfo = new TagInfo(tagName,
+ tagClassName,
+ bodycontent,
+ info,
+ this,
tei,
tagAttributeInfo,
- displayName,
- smallIcon,
- largeIcon,
- tagVariableInfos,
+ displayName,
+ smallIcon,
+ largeIcon,
+ tagVariableInfos,
dynamicAttributes);
return taginfo;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org