当前位置: 首页>>代码示例>>Java>>正文


Java TagPluginContext类代码示例

本文整理汇总了Java中org.apache.jasper.compiler.tagplugin.TagPluginContext的典型用法代码示例。如果您正苦于以下问题:Java TagPluginContext类的具体用法?Java TagPluginContext怎么用?Java TagPluginContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TagPluginContext类属于org.apache.jasper.compiler.tagplugin包,在下文中一共展示了TagPluginContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {
    String condV = ctxt.getTemporaryVariableName();
    ctxt.generateJavaSource("boolean " + condV + "=");
    ctxt.generateAttribute("test");
    ctxt.generateJavaSource(";");
    if (ctxt.isAttributeSpecified("var")) {
        String scope = "PageContext.PAGE_SCOPE";
        if (ctxt.isAttributeSpecified("scope")) {
            String scopeStr = ctxt.getConstantAttribute("scope");
            if ("request".equals(scopeStr)) {
                scope = "PageContext.REQUEST_SCOPE";
            } else if ("session".equals(scopeStr)) {
                scope = "PageContext.SESSION_SCOPE";
            } else if ("application".equals(scopeStr)) {
                scope = "PageContext.APPLICATION_SCOPE";
            }
        }
        ctxt.generateJavaSource("_jspx_page_context.setAttribute(");
        ctxt.generateAttribute("var");
        ctxt.generateJavaSource(", new Boolean(" + condV + ")," + scope + ");");
    }
    ctxt.generateJavaSource("if (" + condV + "){");
    ctxt.generateBody();
    ctxt.generateJavaSource("}");
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:If.java

示例2: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {
    
    //scope flag
    boolean hasScope = ctxt.isAttributeSpecified("scope");
    
    //the value of the "var"
    String strVar = ctxt.getConstantAttribute("var");
    
    //remove attribute from certain scope.
    //default scope is "page".
    if(hasScope){
        int iScope = Util.getScope(ctxt.getConstantAttribute("scope"));
        ctxt.generateJavaSource("pageContext.removeAttribute(\"" + strVar + "\"," + iScope + ");");
    }else{
        ctxt.generateJavaSource("pageContext.removeAttribute(\"" + strVar + "\");");
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:Remove.java

示例3: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {
    // Get the parent context to determine if this is the first <c:when>
    TagPluginContext parentContext = ctxt.getParentContext();
    if (parentContext == null) {
        ctxt.dontUseTagPlugin();
        return;
    }
    
    if ("true".equals(parentContext.getPluginAttribute("hasBeenHere"))) {
        ctxt.generateJavaSource("} else if(");
        // See comment below for the reason we generate the extra "}" here.
    }
    else {
        ctxt.generateJavaSource("if(");
        parentContext.setPluginAttribute("hasBeenHere", "true");
    }
    ctxt.generateAttribute("test");
    ctxt.generateJavaSource("){");
    ctxt.generateBody();
    
    // We don't generate the closing "}" for the "if" here because there
    // may be whitespaces in between <c:when>'s.  Instead we delay
    // generating it until the next <c:when> or <c:otherwise> or
    // <c:choose>
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:When.java

示例4: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
public void doTag(TagPluginContext ctxt) {
    
    //scope flag
    boolean hasScope = ctxt.isAttributeSpecified("scope");
    
    //the value of the "var"
    String strVar = ctxt.getConstantAttribute("var");
    
    //remove attribute from certain scope.
    //default scope is "page".
    if(hasScope){
        int iScope = Util.getScope(ctxt.getConstantAttribute("scope"));
        ctxt.generateJavaSource("pageContext.removeAttribute(\"" + strVar + "\"," + iScope + ");");
    }else{
        ctxt.generateJavaSource("pageContext.removeAttribute(\"" + strVar + "\");");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:Remove.java

示例5: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {
	String condV = ctxt.getTemporaryVariableName();
	ctxt.generateJavaSource("boolean " + condV + "=");
	ctxt.generateAttribute("test");
	ctxt.generateJavaSource(";");
	if (ctxt.isAttributeSpecified("var")) {
		String scope = "PageContext.PAGE_SCOPE";
		if (ctxt.isAttributeSpecified("scope")) {
			String scopeStr = ctxt.getConstantAttribute("scope");
			if ("request".equals(scopeStr)) {
				scope = "PageContext.REQUEST_SCOPE";
			} else if ("session".equals(scopeStr)) {
				scope = "PageContext.SESSION_SCOPE";
			} else if ("application".equals(scopeStr)) {
				scope = "PageContext.APPLICATION_SCOPE";
			}
		}
		ctxt.generateJavaSource("_jspx_page_context.setAttribute(");
		ctxt.generateAttribute("var");
		ctxt.generateJavaSource(", new Boolean(" + condV + ")," + scope + ");");
	}
	ctxt.generateJavaSource("if (" + condV + "){");
	ctxt.generateBody();
	ctxt.generateJavaSource("}");
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:27,代码来源:If.java

示例6: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {

	// scope flag
	boolean hasScope = ctxt.isAttributeSpecified("scope");

	// the value of the "var"
	String strVar = ctxt.getConstantAttribute("var");

	// remove attribute from certain scope.
	// default scope is "page".
	if (hasScope) {
		int iScope = Util.getScope(ctxt.getConstantAttribute("scope"));
		ctxt.generateJavaSource("pageContext.removeAttribute(\"" + strVar + "\"," + iScope + ");");
	} else {
		ctxt.generateJavaSource("pageContext.removeAttribute(\"" + strVar + "\");");
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:19,代码来源:Remove.java

示例7: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {
	// Get the parent context to determine if this is the first <c:when>
	TagPluginContext parentContext = ctxt.getParentContext();
	if (parentContext == null) {
		ctxt.dontUseTagPlugin();
		return;
	}

	if ("true".equals(parentContext.getPluginAttribute("hasBeenHere"))) {
		ctxt.generateJavaSource("} else if(");
		// See comment below for the reason we generate the extra "}" here.
	} else {
		ctxt.generateJavaSource("if(");
		parentContext.setPluginAttribute("hasBeenHere", "true");
	}
	ctxt.generateAttribute("test");
	ctxt.generateJavaSource("){");
	ctxt.generateBody();

	// We don't generate the closing "}" for the "if" here because there
	// may be whitespaces in between <c:when>'s. Instead we delay
	// generating it until the next <c:when> or <c:otherwise> or
	// <c:choose>
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:26,代码来源:When.java

示例8: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {

    //scope flag
    boolean hasScope = ctxt.isAttributeSpecified("scope");

    //the value of the "var"
    String strVar = ctxt.getConstantAttribute("var");

    //remove attribute from certain scope.
    //default scope is "page".
    if(hasScope){
        int iScope = Util.getScope(ctxt.getConstantAttribute("scope"));
        ctxt.generateJavaSource("pageContext.removeAttribute(\"" + strVar + "\"," + iScope + ");");
    }else{
        ctxt.generateJavaSource("pageContext.removeAttribute(\"" + strVar + "\");");
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:19,代码来源:Remove.java

示例9: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {
    // Get the parent context to determine if this is the first <c:when>
    TagPluginContext parentContext = ctxt.getParentContext();
    if (parentContext == null) {
        ctxt.dontUseTagPlugin();
        return;
    }

    if ("true".equals(parentContext.getPluginAttribute("hasBeenHere"))) {
        ctxt.generateJavaSource("} else if(");
        // See comment below for the reason we generate the extra "}" here.
    }
    else {
        ctxt.generateJavaSource("if(");
        parentContext.setPluginAttribute("hasBeenHere", "true");
    }
    ctxt.generateAttribute("test");
    ctxt.generateJavaSource("){");
    ctxt.generateBody();

    // We don't generate the closing "}" for the "if" here because there
    // may be whitespaces in between <c:when>'s.  Instead we delay
    // generating it until the next <c:when> or <c:otherwise> or
    // <c:choose>
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:27,代码来源:When.java

示例10: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {
    
    // See When.java for the reason whey "}" is need at the beginng and
    // not at the end.
    ctxt.generateJavaSource("} else {");
    ctxt.generateBody();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:Otherwise.java

示例11: doTag

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public void doTag(TagPluginContext ctxt) {
    
    // Not much to do here, much of the work will be done in the
    // containing tags, <c:when> and <c:otherwise>.
    
    ctxt.generateBody();
    // See comments in When.java for the reason "}" is generated here.
    ctxt.generateJavaSource("}");
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:11,代码来源:Choose.java

示例12: invokePlugin

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
/**
 * Invoke tag plugin for the given custom tag, if a plugin exists for
 * the custom tag's tag handler.
 *
 * The given custom tag node will be manipulated by the plugin.
 */
private void invokePlugin(Node.CustomTag n, PageInfo pageInfo) {
    TagPlugin tagPlugin = tagPlugins.get(n.getTagHandlerClass().getName());
    if (tagPlugin == null) {
        return;
    }

    TagPluginContext tagPluginContext = new TagPluginContextImpl(n, pageInfo);
    n.setTagPluginContext(tagPluginContext);
    tagPlugin.doTag(tagPluginContext);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:TagPluginManager.java

示例13: getParentContext

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
@Override
public TagPluginContext getParentContext() {
    Node parent = node.getParent();
    if (! (parent instanceof Node.CustomTag)) {
        return null;
    }
    return ((Node.CustomTag) parent).getTagPluginContext();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:TagPluginManager.java

示例14: invokePlugin

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
/**
    * Invoke tag plugin for the given custom tag, if a plugin exists for 
    * the custom tag's tag handler.
    *
    * The given custom tag node will be manipulated by the plugin.
    */
   private void invokePlugin(Node.CustomTag n) {
TagPlugin tagPlugin = (TagPlugin)
	tagPlugins.get(n.getTagHandlerClass().getName());
if (tagPlugin == null) {
    return;
}

TagPluginContext tagPluginContext = new TagPluginContextImpl(n, pageInfo);
n.setTagPluginContext(tagPluginContext);
tagPlugin.doTag(tagPluginContext);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:TagPluginManager.java

示例15: getParentContext

import org.apache.jasper.compiler.tagplugin.TagPluginContext; //导入依赖的package包/类
public TagPluginContext getParentContext() {
    Node parent = node.getParent();
    if (! (parent instanceof Node.CustomTag)) {
	return null;
    }
    return ((Node.CustomTag) parent).getTagPluginContext();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:TagPluginManager.java


注:本文中的org.apache.jasper.compiler.tagplugin.TagPluginContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。