Java Code Examples for javax.servlet.jsp.tagext.TagVariableInfo#getDeclare()

The following examples show how to use javax.servlet.jsp.tagext.TagVariableInfo#getDeclare() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Generator.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private void declareScriptingVars(Node.CustomTag n, int scope) {
    if (isFragment) {
        // No need to declare Java variables, if we inside a
        // JspFragment, because a fragment is always scriptless.
        return;
    }

    List<Object> vec = n.getScriptingVars(scope);
    if (vec != null) {
        for (int i = 0; i < vec.size(); i++) {
            Object elem = vec.get(i);
            if (elem instanceof VariableInfo) {
                VariableInfo varInfo = (VariableInfo) elem;
                if (varInfo.getDeclare()) {
                    out.printin(varInfo.getClassName());
                    out.print(" ");
                    out.print(varInfo.getVarName());
                    out.println(" = null;");
                }
            } else {
                TagVariableInfo tagVarInfo = (TagVariableInfo) elem;
                if (tagVarInfo.getDeclare()) {
                    String varName = tagVarInfo.getNameGiven();
                    if (varName == null) {
                        varName = n.getTagData().getAttributeString(
                                tagVarInfo.getNameFromAttribute());
                    } else if (tagVarInfo.getNameFromAttribute() != null) {
                        // alias
                        continue;
                    }
                    out.printin(tagVarInfo.getClassName());
                    out.print(" ");
                    out.print(varName);
                    out.println(" = null;");
                }
            }
        }
    }
}
 
Example 2
Source File: Generator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
private void declareScriptingVars(Node.CustomTag n, int scope) {
    if (isFragment) {
        // No need to declare Java variables, if we inside a
        // JspFragment, because a fragment is always scriptless.
        return;
    }

    List<Object> vec = n.getScriptingVars(scope);
    if (vec != null) {
        for (int i = 0; i < vec.size(); i++) {
            Object elem = vec.get(i);
            if (elem instanceof VariableInfo) {
                VariableInfo varInfo = (VariableInfo) elem;
                if (varInfo.getDeclare()) {
                    out.printin(varInfo.getClassName());
                    out.print(" ");
                    out.print(varInfo.getVarName());
                    out.println(" = null;");
                }
            } else {
                TagVariableInfo tagVarInfo = (TagVariableInfo) elem;
                if (tagVarInfo.getDeclare()) {
                    String varName = tagVarInfo.getNameGiven();
                    if (varName == null) {
                        varName = n.getTagData().getAttributeString(
                                tagVarInfo.getNameFromAttribute());
                    } else if (tagVarInfo.getNameFromAttribute() != null) {
                        // alias
                        continue;
                    }
                    out.printin(tagVarInfo.getClassName());
                    out.print(" ");
                    out.print(varName);
                    out.println(" = null;");
                }
            }
        }
    }
}
 
Example 3
Source File: Generator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
private void declareScriptingVars(Node.CustomTag n, int scope) {
    if (isFragment) {
        // No need to declare Java variables, if we inside a
        // JspFragment, because a fragment is always scriptless.
        return;
    }

    List<Object> vec = n.getScriptingVars(scope);
    if (vec != null) {
        for (int i = 0; i < vec.size(); i++) {
            Object elem = vec.get(i);
            if (elem instanceof VariableInfo) {
                VariableInfo varInfo = (VariableInfo) elem;
                if (varInfo.getDeclare()) {
                    out.printin(varInfo.getClassName());
                    out.print(" ");
                    out.print(varInfo.getVarName());
                    out.println(" = null;");
                }
            } else {
                TagVariableInfo tagVarInfo = (TagVariableInfo) elem;
                if (tagVarInfo.getDeclare()) {
                    String varName = tagVarInfo.getNameGiven();
                    if (varName == null) {
                        varName = n.getTagData().getAttributeString(
                                tagVarInfo.getNameFromAttribute());
                    } else if (tagVarInfo.getNameFromAttribute() != null) {
                        // alias
                        continue;
                    }
                    out.printin(tagVarInfo.getClassName());
                    out.print(" ");
                    out.print(varName);
                    out.println(" = null;");
                }
            }
        }
    }
}
 
Example 4
Source File: Generator.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
private void declareScriptingVars(Node.CustomTag n, int scope) {

            // Skip if the page is scriptless
            if (pageInfo.isScriptless()) return;

            ArrayList<Object> vec = n.getScriptingVars(scope);
            if (vec != null) {
                for (int i = 0; i < vec.size(); i++) {
                    Object elem = vec.get(i);
                    if (elem instanceof VariableInfo) {
                        VariableInfo varInfo = (VariableInfo)elem;
                        if (varInfo.getDeclare()) {
                            out.printin(varInfo.getClassName());
                            out.print(" ");
                            out.print(varInfo.getVarName());
                            out.println(" = null;");
                        }
                    } else {
                        TagVariableInfo tagVarInfo = (TagVariableInfo)elem;
                        if (tagVarInfo.getDeclare()) {
                            String varName = tagVarInfo.getNameGiven();
                            if (varName == null) {
                                varName =
                                    n.getTagData().getAttributeString(
                                        tagVarInfo.getNameFromAttribute());
                            } else if (
                                tagVarInfo.getNameFromAttribute() != null) {
                                // alias
                                continue;
                            }
                            out.printin(tagVarInfo.getClassName());
                            out.print(" ");
                            out.print(varName);
                            out.println(" = null;");
                        }
                    }
                }
            }
        }