Example usage for javax.servlet.jsp.tagext VariableInfo AT_BEGIN

List of usage examples for javax.servlet.jsp.tagext VariableInfo AT_BEGIN

Introduction

In this page you can find the example usage for javax.servlet.jsp.tagext VariableInfo AT_BEGIN.

Prototype

int AT_BEGIN

To view the source code for javax.servlet.jsp.tagext VariableInfo AT_BEGIN.

Click Source Link

Document

Scope information that scripting variable is visible after start tag.

Usage

From source file:com.draagon.meta.web.tag.MetaObjectTEI.java

public VariableInfo[] getVariableInfo(TagData data) {
    if (data.getAttributeString("var") == null) {
        return new VariableInfo[0];
    } else {//www  . java 2  s  .  c  o m
        return new VariableInfo[] { new VariableInfo(data.getAttributeString("var"), String.class.getName(),
                true, VariableInfo.AT_BEGIN), };
    }
}

From source file:org.apache.jasper.compiler.TagLibraryInfoImpl.java

TagVariableInfo createVariable(TreeNode elem) {
    String nameGiven = null;//w  w  w .  j  a va  2  s.  co  m
    String nameFromAttribute = null;
    String className = "java.lang.String";
    boolean declare = true;
    int scope = VariableInfo.NESTED;

    Iterator list = elem.findChildren();
    while (list.hasNext()) {
        TreeNode element = (TreeNode) list.next();
        String tname = element.getName();
        if ("name-given".equals(tname))
            nameGiven = element.getBody();
        else if ("name-from-attribute".equals(tname))
            nameFromAttribute = element.getBody();
        else if ("variable-class".equals(tname))
            className = element.getBody();
        else if ("declare".equals(tname)) {
            String s = element.getBody();
            if (s != null)
                declare = JspUtil.booleanValue(s);
        } else if ("scope".equals(tname)) {
            String s = element.getBody();
            if (s != null) {
                if ("NESTED".equals(s)) {
                    scope = VariableInfo.NESTED;
                } else if ("AT_BEGIN".equals(s)) {
                    scope = VariableInfo.AT_BEGIN;
                } else if ("AT_END".equals(s)) {
                    scope = VariableInfo.AT_END;
                }
            }
        } else if ("description".equals(tname) || // Ignored elements
                false) {
        } else {
            if (log.isWarnEnabled()) {
                log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.variable", tname));
            }
        }
    }
    return new TagVariableInfo(nameGiven, nameFromAttribute, className, declare, scope);
}

From source file:org.apache.jasper.runtime.JspContextWrapper.java

/**
 * Synchronize variables before fragment invokation
 */
public void syncBeforeInvoke() {
    copyTagToPageScope(VariableInfo.NESTED);
    copyTagToPageScope(VariableInfo.AT_BEGIN);
}

From source file:org.apache.jasper.runtime.JspContextWrapper.java

/**
 * Synchronize variables at end of tag file
 *///w  ww. j  ava 2s  . c  om
public void syncEndTagFile() {
    copyTagToPageScope(VariableInfo.AT_BEGIN);
    copyTagToPageScope(VariableInfo.AT_END);
    restoreNestedVariables();
}

From source file:org.apache.jasper.runtime.JspContextWrapper.java

/**
 * Copies the variables of the given scope from the virtual page scope of
 * this JSP context wrapper to the page scope of the invoking JSP context.
 *
 * @param scope variable scope (one of NESTED, AT_BEGIN, or AT_END)
 *///w w w  .  j a  va  2s .co  m
private void copyTagToPageScope(int scope) {
    Iterator iter = null;

    switch (scope) {
    case VariableInfo.NESTED:
        if (nestedVars != null) {
            iter = nestedVars.iterator();
        }
        break;
    case VariableInfo.AT_BEGIN:
        if (atBeginVars != null) {
            iter = atBeginVars.iterator();
        }
        break;
    case VariableInfo.AT_END:
        if (atEndVars != null) {
            iter = atEndVars.iterator();
        }
        break;
    }

    while ((iter != null) && iter.hasNext()) {
        String varName = (String) iter.next();
        Object obj = getAttribute(varName);
        varName = findAlias(varName);
        if (obj != null) {
            invokingJspCtxt.setAttribute(varName, obj);
        } else {
            invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE);
        }
    }
}

From source file:org.tinygroup.jspengine.compiler.TagLibraryInfoImpl.java

private TagVariableInfo createVariable(TreeNode elem) throws JasperException {

    String nameGiven = null;/*from   w w w . j  a  v a 2  s .  co  m*/
    String nameFromAttribute = null;
    String className = "java.lang.String";
    boolean declare = true;
    int scope = VariableInfo.NESTED;

    Iterator list = elem.findChildren();
    while (list.hasNext()) {
        TreeNode element = (TreeNode) list.next();
        String tname = element.getName();
        if ("name-given".equals(tname))
            nameGiven = element.getBody();
        else if ("name-from-attribute".equals(tname))
            nameFromAttribute = element.getBody();
        else if ("variable-class".equals(tname))
            className = element.getBody();
        else if ("declare".equals(tname)) {
            String s = element.getBody();
            if (s != null)
                declare = JspUtil.booleanValue(s);
        } else if ("scope".equals(tname)) {
            String s = element.getBody();
            if (s != null) {
                if ("NESTED".equals(s)) {
                    scope = VariableInfo.NESTED;
                } else if ("AT_BEGIN".equals(s)) {
                    scope = VariableInfo.AT_BEGIN;
                } else if ("AT_END".equals(s)) {
                    scope = VariableInfo.AT_END;
                }
            }
        } else if ("description".equals(tname) || // Ignored elements
                false) {
        } else {
            err.jspError("jsp.error.unknown.element.in.variable", tname);
        }
    }
    return new TagVariableInfo(nameGiven, nameFromAttribute, className, declare, scope);
}