本文整理汇总了Java中javax.servlet.jsp.tagext.TagInfo.getAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java TagInfo.getAttributes方法的具体用法?Java TagInfo.getAttributes怎么用?Java TagInfo.getAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.servlet.jsp.tagext.TagInfo
的用法示例。
在下文中一共展示了TagInfo.getAttributes方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTagAttributeInfo
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
public TagAttributeInfo getTagAttributeInfo(String name) {
TagInfo info = this.getTagInfo();
if (info == null)
return null;
TagAttributeInfo[] tai = info.getAttributes();
for (int i = 0; i < tai.length; i++) {
if (tai[i].getName().equals(name)) {
return tai[i];
}
}
return null;
}
示例2: checkNamedAttributes
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
private void checkNamedAttributes(Node.CustomTag n,
Node.JspAttribute[] jspAttrs, int start,
Hashtable<String, Object> tagDataAttrs)
throws JasperException {
TagInfo tagInfo = n.getTagInfo();
if (tagInfo == null) {
err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
}
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
Node.Nodes naNodes = n.getNamedAttributeNodes();
for (int i = 0; i < naNodes.size(); i++) {
Node.NamedAttribute na = (Node.NamedAttribute) naNodes
.getNode(i);
boolean found = false;
for (int j = 0; j < tldAttrs.length; j++) {
/*
* See above comment about namespace matches. For named
* attributes, we use the prefix instead of URI as the match
* criterion, because in the case of a JSP document, we'd
* have to keep track of which namespaces are in scope when
* parsing a named attribute, in order to determine the URI
* that the prefix of the named attribute's name matches to.
*/
String attrPrefix = na.getPrefix();
if (na.getLocalName().equals(tldAttrs[j].getName())
&& (attrPrefix == null || attrPrefix.length() == 0 || attrPrefix
.equals(n.getPrefix()))) {
jspAttrs[start + i] = new Node.JspAttribute(na,
tldAttrs[j], false);
NamedAttributeVisitor nav = null;
if (na.getBody() != null) {
nav = new NamedAttributeVisitor();
na.getBody().visit(nav);
}
if (nav != null && nav.hasDynamicContent()) {
tagDataAttrs.put(na.getName(),
TagData.REQUEST_TIME_VALUE);
} else {
tagDataAttrs.put(na.getName(), na.getText());
}
found = true;
break;
}
}
if (!found) {
if (tagInfo.hasDynamicAttributes()) {
jspAttrs[start + i] = new Node.JspAttribute(na, null,
true);
} else {
err.jspError(n, "jsp.error.bad_attribute",
na.getName(), n.getLocalName());
}
}
}
}
示例3: getAttributeBodyType
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
/**
* Determine the body type of <jsp:attribute> from the enclosing node
*/
private String getAttributeBodyType(Node n, String name) {
if (n instanceof Node.CustomTag) {
TagInfo tagInfo = ((Node.CustomTag) n).getTagInfo();
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
for (int i = 0; i < tldAttrs.length; i++) {
if (name.equals(tldAttrs[i].getName())) {
if (tldAttrs[i].isFragment()) {
return TagInfo.BODY_CONTENT_SCRIPTLESS;
}
if (tldAttrs[i].canBeRequestTime()) {
return TagInfo.BODY_CONTENT_JSP;
}
}
}
if (tagInfo.hasDynamicAttributes()) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.IncludeAction) {
if ("page".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.ForwardAction) {
if ("page".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.SetProperty) {
if ("value".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.UseBean) {
if ("beanName".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.PlugIn) {
if ("width".equals(name) || "height".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.ParamAction) {
if ("value".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.JspElement) {
return TagInfo.BODY_CONTENT_JSP;
}
return JAVAX_BODY_CONTENT_TEMPLATE_TEXT;
}
示例4: generateTagHandlerPostamble
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
private void generateTagHandlerPostamble(TagInfo tagInfo) {
out.popIndent();
// Have to catch Throwable because a classic tag handler
// helper method is declared to throw Throwable.
out.printil("} catch( java.lang.Throwable t ) {");
out.pushIndent();
out.printil("if( t instanceof javax.servlet.jsp.SkipPageException )");
out.printil(" throw (javax.servlet.jsp.SkipPageException) t;");
out.printil("if( t instanceof java.io.IOException )");
out.printil(" throw (java.io.IOException) t;");
out.printil("if( t instanceof java.lang.IllegalStateException )");
out.printil(" throw (java.lang.IllegalStateException) t;");
out.printil("if( t instanceof javax.servlet.jsp.JspException )");
out.printil(" throw (javax.servlet.jsp.JspException) t;");
out.printil("throw new javax.servlet.jsp.JspException(t);");
out.popIndent();
out.printil("} finally {");
out.pushIndent();
// handle restoring VariableMapper
TagAttributeInfo[] attrInfos = tagInfo.getAttributes();
for (int i = 0; i < attrInfos.length; i++) {
if (attrInfos[i].isDeferredMethod() || attrInfos[i].isDeferredValue()) {
out.printin("_el_variablemapper.setVariable(");
out.print(quote(attrInfos[i].getName()));
out.print(",_el_ve");
out.print(i);
out.println(");");
}
}
// restore nested JspContext on ELContext
out.printil("jspContext.getELContext().putContext(javax.servlet.jsp.JspContext.class,super.getJspContext());");
out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).syncEndTagFile();");
if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) {
out.printil("_jspDestroy();");
}
out.popIndent();
out.printil("}");
// Close the doTag method
out.popIndent();
out.printil("}");
// Generated methods, helper classes, etc.
genCommonPostamble();
}
示例5: generateTagHandlerAttributes
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
/**
* Generates declarations for tag handler attributes, and defines the getter
* and setter methods for each.
*/
private void generateTagHandlerAttributes(TagInfo tagInfo) {
if (tagInfo.hasDynamicAttributes()) {
out.printil("private java.util.HashMap _jspx_dynamic_attrs = new java.util.HashMap();");
}
// Declare attributes
TagAttributeInfo[] attrInfos = tagInfo.getAttributes();
for (int i = 0; i < attrInfos.length; i++) {
out.printin("private ");
if (attrInfos[i].isFragment()) {
out.print("javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName()));
out.print(" ");
}
out.print(JspUtil.makeJavaIdentifierForAttribute(
attrInfos[i].getName()));
out.println(";");
}
out.println();
// Define attribute getter and setter methods
for (int i = 0; i < attrInfos.length; i++) {
String javaName =
JspUtil.makeJavaIdentifierForAttribute(attrInfos[i].getName());
// getter method
out.printin("public ");
if (attrInfos[i].isFragment()) {
out.print("javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName()));
out.print(" ");
}
out.print(toGetterMethod(attrInfos[i].getName()));
out.println(" {");
out.pushIndent();
out.printin("return this.");
out.print(javaName);
out.println(";");
out.popIndent();
out.printil("}");
out.println();
// setter method
out.printin("public void ");
out.print(toSetterMethodName(attrInfos[i].getName()));
if (attrInfos[i].isFragment()) {
out.print("(javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print("(");
out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName()));
out.print(" ");
}
out.print(javaName);
out.println(") {");
out.pushIndent();
out.printin("this.");
out.print(javaName);
out.print(" = ");
out.print(javaName);
out.println(";");
if (ctxt.isTagFile()) {
// Tag files should also set jspContext attributes
out.printin("jspContext.setAttribute(\"");
out.print(attrInfos[i].getName());
out.print("\", ");
out.print(javaName);
out.println(");");
}
out.popIndent();
out.printil("}");
out.println();
}
}
示例6: checkNamedAttributes
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
private void checkNamedAttributes(Node.CustomTag n,
Node.JspAttribute[] jspAttrs, int start,
Hashtable<String, Object> tagDataAttrs)
throws JasperException {
TagInfo tagInfo = n.getTagInfo();
if (tagInfo == null) {
err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
}
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
Node.Nodes naNodes = n.getNamedAttributeNodes();
for (int i = 0; i < naNodes.size(); i++) {
Node.NamedAttribute na = (Node.NamedAttribute) naNodes
.getNode(i);
boolean found = false;
for (int j = 0; j < tldAttrs.length; j++) {
/*
* See above comment about namespace matches. For named
* attributes, we use the prefix instead of URI as the match
* criterion, because in the case of a JSP document, we'd
* have to keep track of which namespaces are in scope when
* parsing a named attribute, in order to determine the URI
* that the prefix of the named attribute's name matches to.
*/
String attrPrefix = na.getPrefix();
if (na.getLocalName().equals(tldAttrs[j].getName())
&& (attrPrefix == null || attrPrefix.length() == 0 || attrPrefix
.equals(n.getPrefix()))) {
jspAttrs[start + i] = new Node.JspAttribute(na,
tldAttrs[j], false);
NamedAttributeVisitor nav = null;
if (na.getBody() != null) {
nav = new NamedAttributeVisitor();
na.getBody().visit(nav);
}
if (nav != null && nav.hasDynamicContent()) {
tagDataAttrs.put(na.getName(),
TagData.REQUEST_TIME_VALUE);
} else {
tagDataAttrs.put(na.getName(), na.getText());
}
found = true;
break;
}
}
if (!found) {
if (tagInfo.hasDynamicAttributes()) {
jspAttrs[start + i] = new Node.JspAttribute(na, null,
true);
} else {
err.jspError(n, "jsp.error.bad_attribute",
na.getName(), n.getLocalName());
}
}
}
}
示例7: generateTagHandlerPostamble
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
private void generateTagHandlerPostamble(TagInfo tagInfo) {
out.popIndent();
// Have to catch Throwable because a classic tag handler
// helper method is declared to throw Throwable.
out.printil("} catch( Throwable t ) {");
out.pushIndent();
out.printil("if( t instanceof SkipPageException )");
out.printil(" throw (SkipPageException) t;");
out.printil("if( t instanceof java.io.IOException )");
out.printil(" throw (java.io.IOException) t;");
out.printil("if( t instanceof IllegalStateException )");
out.printil(" throw (IllegalStateException) t;");
out.printil("if( t instanceof JspException )");
out.printil(" throw (JspException) t;");
out.printil("throw new JspException(t);");
out.popIndent();
out.printil("} finally {");
out.pushIndent();
// handle restoring VariableMapper
TagAttributeInfo[] attrInfos = tagInfo.getAttributes();
for (int i = 0; i < attrInfos.length; i++) {
if (attrInfos[i].isDeferredMethod() || attrInfos[i].isDeferredValue()) {
out.printin("_el_variablemapper.setVariable(");
out.print(quote(attrInfos[i].getName()));
out.print(",_el_ve");
out.print(i);
out.println(");");
}
}
// restore nested JspContext on ELContext
out.printil("jspContext.getELContext().putContext(JspContext.class,super.getJspContext());");
out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).syncEndTagFile();");
if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) {
out.printil("_jspDestroy();");
}
out.popIndent();
out.printil("}");
// Close the doTag method
out.popIndent();
out.printil("}");
// Generated methods, helper classes, etc.
genCommonPostamble();
}
示例8: generateTagHandlerAttributes
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
/**
* Generates declarations for tag handler attributes, and defines the getter
* and setter methods for each.
*/
private void generateTagHandlerAttributes(TagInfo tagInfo)
throws JasperException {
if (tagInfo.hasDynamicAttributes()) {
out.printil("private java.util.HashMap _jspx_dynamic_attrs = new java.util.HashMap();");
}
// Declare attributes
TagAttributeInfo[] attrInfos = tagInfo.getAttributes();
for (int i = 0; i < attrInfos.length; i++) {
out.printin("private ");
if (attrInfos[i].isFragment()) {
out.print("javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName()));
out.print(" ");
}
out.print(attrInfos[i].getName());
out.println(";");
}
out.println();
// Define attribute getter and setter methods
if (attrInfos != null) {
for (int i = 0; i < attrInfos.length; i++) {
// getter method
out.printin("public ");
if (attrInfos[i].isFragment()) {
out.print("javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print(JspUtil.toJavaSourceType(attrInfos[i]
.getTypeName()));
out.print(" ");
}
out.print(toGetterMethod(attrInfos[i].getName()));
out.println(" {");
out.pushIndent();
out.printin("return this.");
out.print(attrInfos[i].getName());
out.println(";");
out.popIndent();
out.printil("}");
out.println();
// setter method
out.printin("public void ");
out.print(toSetterMethodName(attrInfos[i].getName()));
if (attrInfos[i].isFragment()) {
out.print("(javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print("(");
out.print(JspUtil.toJavaSourceType(attrInfos[i]
.getTypeName()));
out.print(" ");
}
out.print(attrInfos[i].getName());
out.println(") {");
out.pushIndent();
out.printin("this.");
out.print(attrInfos[i].getName());
out.print(" = ");
out.print(attrInfos[i].getName());
out.println(";");
if (ctxt.isTagFile()) {
// Tag files should also set jspContext attributes
out.printin("jspContext.setAttribute(\"");
out.print(attrInfos[i].getName());
out.print("\", ");
out.print(attrInfos[i].getName());
out.println(");");
}
out.popIndent();
out.printil("}");
out.println();
}
}
}
示例9: visit
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
@Override
public void visit(Node.CustomTag n) throws JasperException {
TagInfo tagInfo = n.getTagInfo();
if (tagInfo == null) {
err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
}
/*
* The bodycontent of a SimpleTag cannot be JSP.
*/
if (n.implementsSimpleTag() && tagInfo.getBodyContent().equalsIgnoreCase(TagInfo.BODY_CONTENT_JSP)) {
err.jspError(n, "jsp.error.simpletag.badbodycontent", tagInfo.getTagClassName());
}
/*
* If the tag handler declares in the TLD that it supports dynamic
* attributes, it also must implement the DynamicAttributes
* interface.
*/
if (tagInfo.hasDynamicAttributes() && !n.implementsDynamicAttributes()) {
err.jspError(n, "jsp.error.dynamic.attributes.not.implemented", n.getQName());
}
/*
* Make sure all required attributes are present, either as
* attributes or named attributes (<jsp:attribute>). Also make sure
* that the same attribute is not specified in both attributes or
* named attributes.
*/
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
String customActionUri = n.getURI();
Attributes attrs = n.getAttributes();
int attrsSize = (attrs == null) ? 0 : attrs.getLength();
for (int i = 0; i < tldAttrs.length; i++) {
String attr = null;
if (attrs != null) {
attr = attrs.getValue(tldAttrs[i].getName());
if (attr == null) {
attr = attrs.getValue(customActionUri, tldAttrs[i].getName());
}
}
Node.NamedAttribute na = n.getNamedAttributeNode(tldAttrs[i].getName());
if (tldAttrs[i].isRequired() && attr == null && na == null) {
err.jspError(n, "jsp.error.missing_attribute", tldAttrs[i].getName(), n.getLocalName());
}
if (attr != null && na != null) {
err.jspError(n, "jsp.error.duplicate.name.jspattribute", tldAttrs[i].getName());
}
}
Node.Nodes naNodes = n.getNamedAttributeNodes();
int jspAttrsSize = naNodes.size() + attrsSize;
Node.JspAttribute[] jspAttrs = null;
if (jspAttrsSize > 0) {
jspAttrs = new Node.JspAttribute[jspAttrsSize];
}
Hashtable<String, Object> tagDataAttrs = new Hashtable<String, Object>(attrsSize);
checkXmlAttributes(n, jspAttrs, tagDataAttrs);
checkNamedAttributes(n, jspAttrs, attrsSize, tagDataAttrs);
TagData tagData = new TagData(tagDataAttrs);
// JSP.C1: It is a (translation time) error for an action that
// has one or more variable subelements to have a TagExtraInfo
// class that returns a non-null object.
TagExtraInfo tei = tagInfo.getTagExtraInfo();
if (tei != null && tei.getVariableInfo(tagData) != null && tei.getVariableInfo(tagData).length > 0
&& tagInfo.getTagVariableInfos().length > 0) {
err.jspError("jsp.error.non_null_tei_and_var_subelems", n.getQName());
}
n.setTagData(tagData);
n.setJspAttributes(jspAttrs);
visitBody(n);
}
示例10: checkNamedAttributes
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
private void checkNamedAttributes(Node.CustomTag n, Node.JspAttribute[] jspAttrs, int start,
Hashtable<String, Object> tagDataAttrs) throws JasperException {
TagInfo tagInfo = n.getTagInfo();
if (tagInfo == null) {
err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
}
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
Node.Nodes naNodes = n.getNamedAttributeNodes();
for (int i = 0; i < naNodes.size(); i++) {
Node.NamedAttribute na = (Node.NamedAttribute) naNodes.getNode(i);
boolean found = false;
for (int j = 0; j < tldAttrs.length; j++) {
/*
* See above comment about namespace matches. For named
* attributes, we use the prefix instead of URI as the match
* criterion, because in the case of a JSP document, we'd
* have to keep track of which namespaces are in scope when
* parsing a named attribute, in order to determine the URI
* that the prefix of the named attribute's name matches to.
*/
String attrPrefix = na.getPrefix();
if (na.getLocalName().equals(tldAttrs[j].getName())
&& (attrPrefix == null || attrPrefix.length() == 0 || attrPrefix.equals(n.getPrefix()))) {
jspAttrs[start + i] = new Node.JspAttribute(na, tldAttrs[j], false);
NamedAttributeVisitor nav = null;
if (na.getBody() != null) {
nav = new NamedAttributeVisitor();
na.getBody().visit(nav);
}
if (nav != null && nav.hasDynamicContent()) {
tagDataAttrs.put(na.getName(), TagData.REQUEST_TIME_VALUE);
} else {
tagDataAttrs.put(na.getName(), na.getText());
}
found = true;
break;
}
}
if (!found) {
if (tagInfo.hasDynamicAttributes()) {
jspAttrs[start + i] = new Node.JspAttribute(na, null, true);
} else {
err.jspError(n, "jsp.error.bad_attribute", na.getName(), n.getLocalName());
}
}
}
}
示例11: getAttributeBodyType
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
/**
* Determine the body type of <jsp:attribute> from the enclosing node
*/
private String getAttributeBodyType(Node n, String name) {
if (n instanceof Node.CustomTag) {
TagInfo tagInfo = ((Node.CustomTag) n).getTagInfo();
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
for (int i = 0; i < tldAttrs.length; i++) {
if (name.equals(tldAttrs[i].getName())) {
if (tldAttrs[i].isFragment()) {
return TagInfo.BODY_CONTENT_SCRIPTLESS;
}
if (tldAttrs[i].canBeRequestTime()) {
return TagInfo.BODY_CONTENT_JSP;
}
}
}
if (tagInfo.hasDynamicAttributes()) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.IncludeAction) {
if ("page".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.ForwardAction) {
if ("page".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.SetProperty) {
if ("value".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.UseBean) {
if ("beanName".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.PlugIn) {
if ("width".equals(name) || "height".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.ParamAction) {
if ("value".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.JspElement) {
return TagInfo.BODY_CONTENT_JSP;
}
return JAVAX_BODY_CONTENT_TEMPLATE_TEXT;
}
示例12: generateTagHandlerPostamble
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
private void generateTagHandlerPostamble(TagInfo tagInfo) {
out.popIndent();
// Have to catch Throwable because a classic tag handler
// helper method is declared to throw Throwable.
out.printil("} catch( java.lang.Throwable t ) {");
out.pushIndent();
out.printil("if( t instanceof javax.servlet.jsp.SkipPageException )");
out.printil(" throw (javax.servlet.jsp.SkipPageException) t;");
out.printil("if( t instanceof java.io.IOException )");
out.printil(" throw (java.io.IOException) t;");
out.printil("if( t instanceof java.lang.IllegalStateException )");
out.printil(" throw (java.lang.IllegalStateException) t;");
out.printil("if( t instanceof javax.servlet.jsp.JspException )");
out.printil(" throw (javax.servlet.jsp.JspException) t;");
out.printil("throw new javax.servlet.jsp.JspException(t);");
out.popIndent();
out.printil("} finally {");
out.pushIndent();
// handle restoring VariableMapper
TagAttributeInfo[] attrInfos = tagInfo.getAttributes();
for (int i = 0; i < attrInfos.length; i++) {
if (attrInfos[i].isDeferredMethod() || attrInfos[i].isDeferredValue()) {
out.printin("_el_variablemapper.setVariable(");
out.print(quote(attrInfos[i].getName()));
out.print(",_el_ve");
out.print(i);
out.println(");");
}
}
// restore nested JspContext on ELContext
out.printil("jspContext.getELContext().putContext(javax.servlet.jsp.JspContext.class,super.getJspContext());");
out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).syncEndTagFile();");
if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) {
out.printil("_jspDestroy();");
}
out.popIndent();
out.printil("}");
// Close the doTag method
out.popIndent();
out.printil("}");
// Generated methods, helper classes, etc.
genCommonPostamble();
}
示例13: generateTagHandlerAttributes
import javax.servlet.jsp.tagext.TagInfo; //导入方法依赖的package包/类
/**
* Generates declarations for tag handler attributes, and defines the getter
* and setter methods for each.
*/
private void generateTagHandlerAttributes(TagInfo tagInfo) {
if (tagInfo.hasDynamicAttributes()) {
out.printil("private java.util.HashMap _jspx_dynamic_attrs = new java.util.HashMap();");
}
// Declare attributes
TagAttributeInfo[] attrInfos = tagInfo.getAttributes();
for (int i = 0; i < attrInfos.length; i++) {
out.printin("private ");
if (attrInfos[i].isFragment()) {
out.print("javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName()));
out.print(" ");
}
out.print(JspUtil.makeJavaIdentifierForAttribute(attrInfos[i].getName()));
out.println(";");
}
out.println();
// Define attribute getter and setter methods
for (int i = 0; i < attrInfos.length; i++) {
String javaName = JspUtil.makeJavaIdentifierForAttribute(attrInfos[i].getName());
// getter method
out.printin("public ");
if (attrInfos[i].isFragment()) {
out.print("javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName()));
out.print(" ");
}
out.print(toGetterMethod(attrInfos[i].getName()));
out.println(" {");
out.pushIndent();
out.printin("return this.");
out.print(javaName);
out.println(";");
out.popIndent();
out.printil("}");
out.println();
// setter method
out.printin("public void ");
out.print(toSetterMethodName(attrInfos[i].getName()));
if (attrInfos[i].isFragment()) {
out.print("(javax.servlet.jsp.tagext.JspFragment ");
} else {
out.print("(");
out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName()));
out.print(" ");
}
out.print(javaName);
out.println(") {");
out.pushIndent();
out.printin("this.");
out.print(javaName);
out.print(" = ");
out.print(javaName);
out.println(";");
if (ctxt.isTagFile()) {
// Tag files should also set jspContext attributes
out.printin("jspContext.setAttribute(\"");
out.print(attrInfos[i].getName());
out.print("\", ");
out.print(javaName);
out.println(");");
}
out.popIndent();
out.printil("}");
out.println();
}
}