本文整理汇总了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("}");
}
示例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 + "\");");
}
}
示例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>
}
示例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 + "\");");
}
}
示例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("}");
}
示例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 + "\");");
}
}
示例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>
}
示例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 + "\");");
}
}
示例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>
}
示例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();
}
示例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("}");
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}