Java Code Examples for javax.servlet.jsp.tagext.VariableInfo#AT_BEGIN
The following examples show how to use
javax.servlet.jsp.tagext.VariableInfo#AT_BEGIN .
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: Node.java From Tomcat8-Source-Read with MIT License | 6 votes |
public List<Object> getScriptingVars(int scope) { List<Object> vec = null; switch (scope) { case VariableInfo.AT_BEGIN: vec = this.atBeginScriptingVars; break; case VariableInfo.AT_END: vec = this.atEndScriptingVars; break; case VariableInfo.NESTED: vec = this.nestedScriptingVars; break; } return vec; }
Example 2
Source File: Node.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
public List<Object> getScriptingVars(int scope) { List<Object> vec = null; switch (scope) { case VariableInfo.AT_BEGIN: vec = this.atBeginScriptingVars; break; case VariableInfo.AT_END: vec = this.atEndScriptingVars; break; case VariableInfo.NESTED: vec = this.nestedScriptingVars; break; } return vec; }
Example 3
Source File: Node.java From Tomcat8-Source-Read with MIT License | 5 votes |
public void setScriptingVars(List<Object> vec, int scope) { switch (scope) { case VariableInfo.AT_BEGIN: this.atBeginScriptingVars = vec; break; case VariableInfo.AT_END: this.atEndScriptingVars = vec; break; case VariableInfo.NESTED: this.nestedScriptingVars = vec; break; } }
Example 4
Source File: Node.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
public ArrayList<Object> getScriptingVars(int scope) { switch (scope) { case VariableInfo.AT_BEGIN: return this.atBeginScriptingVars; case VariableInfo.AT_END: return this.atEndScriptingVars; case VariableInfo.NESTED: return this.nestedScriptingVars; } return null; }
Example 5
Source File: BaseURLTag.java From portals-pluto with Apache License 2.0 | 5 votes |
public VariableInfo[] getVariableInfo(TagData tagData) { VariableInfo vi[] = null; String var = tagData.getAttributeString("var"); if (var != null) { vi = new VariableInfo[1]; vi[0] = new VariableInfo(var, "java.lang.String", true, VariableInfo.AT_BEGIN); } return vi; }
Example 6
Source File: JspContextWrapper.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * 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) */ private void copyTagToPageScope(int scope) { Iterator<String> 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 = iter.next(); Object obj = getAttribute(varName); varName = findAlias(varName); if (obj != null) { invokingJspCtxt.setAttribute(varName, obj); } else { invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE); } } }
Example 7
Source File: Node.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
public void setScriptingVars(List<Object> vec, int scope) { switch (scope) { case VariableInfo.AT_BEGIN: this.atBeginScriptingVars = vec; break; case VariableInfo.AT_END: this.atEndScriptingVars = vec; break; case VariableInfo.NESTED: this.nestedScriptingVars = vec; break; } }
Example 8
Source File: Node.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
public void setScriptingVars(ArrayList<Object> vec, int scope) { switch (scope) { case VariableInfo.AT_BEGIN: this.atBeginScriptingVars = vec; break; case VariableInfo.AT_END: this.atEndScriptingVars = vec; break; case VariableInfo.NESTED: this.nestedScriptingVars = vec; break; } }
Example 9
Source File: TldRuleSet.java From Tomcat8-Source-Read with MIT License | 5 votes |
public void setScope(String scopeName) { switch (scopeName) { case "NESTED": scope = VariableInfo.NESTED; break; case "AT_BEGIN": scope = VariableInfo.AT_BEGIN; break; case "AT_END": scope = VariableInfo.AT_END; break; } }
Example 10
Source File: JspContextWrapper.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * 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) */ private void copyTagToPageScope(int scope) { Iterator<String> 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 = iter.next(); Object obj = getAttribute(varName); varName = findAlias(varName); if (obj != null) { invokingJspCtxt.setAttribute(varName, obj); } else { invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE); } } }
Example 11
Source File: Node.java From tomcatsrc with Apache License 2.0 | 5 votes |
public void setScriptingVars(List<Object> vec, int scope) { switch (scope) { case VariableInfo.AT_BEGIN: this.atBeginScriptingVars = vec; break; case VariableInfo.AT_END: this.atEndScriptingVars = vec; break; case VariableInfo.NESTED: this.nestedScriptingVars = vec; break; } }
Example 12
Source File: JspContextWrapper.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
/** * 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) */ private void copyTagToPageScope(int scope) { Iterator<String> 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 = iter.next(); Object obj = getAttribute(varName); varName = findAlias(varName); if (obj != null) { invokingJspCtxt.setAttribute(varName, obj); } else { invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE); } } }
Example 13
Source File: TagFileProcessor.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override public void visit(Node.VariableDirective n) throws JasperException { JspUtil.checkAttributes("Variable directive", n, variableDirectiveAttrs, err); String nameGiven = n.getAttributeValue("name-given"); String nameFromAttribute = n .getAttributeValue("name-from-attribute"); if (nameGiven == null && nameFromAttribute == null) { err.jspError("jsp.error.variable.either.name"); } if (nameGiven != null && nameFromAttribute != null) { err.jspError("jsp.error.variable.both.name"); } String alias = n.getAttributeValue("alias"); if (nameFromAttribute != null && alias == null || nameFromAttribute == null && alias != null) { err.jspError("jsp.error.variable.alias"); } String className = n.getAttributeValue("variable-class"); if (className == null) className = "java.lang.String"; String declareStr = n.getAttributeValue("declare"); boolean declare = true; if (declareStr != null) declare = JspUtil.booleanValue(declareStr); int scope = VariableInfo.NESTED; String scopeStr = n.getAttributeValue("scope"); if (scopeStr != null) { if ("NESTED".equals(scopeStr)) { // Already the default } else if ("AT_BEGIN".equals(scopeStr)) { scope = VariableInfo.AT_BEGIN; } else if ("AT_END".equals(scopeStr)) { scope = VariableInfo.AT_END; } } if (nameFromAttribute != null) { /* * An alias has been specified. We use 'nameGiven' to hold the * value of the alias, and 'nameFromAttribute' to hold the name * of the attribute whose value (at invocation-time) denotes the * name of the variable that is being aliased */ nameGiven = alias; checkUniqueName(nameFromAttribute, VAR_NAME_FROM, n); checkUniqueName(alias, VAR_ALIAS, n); } else { // name-given specified checkUniqueName(nameGiven, VAR_NAME_GIVEN, n); } variableVector.addElement(new TagVariableInfo(nameGiven, nameFromAttribute, className, declare, scope)); }
Example 14
Source File: Generator.java From packagedrone with Eclipse Public License 1.0 | 4 votes |
private void generateSetJspContext(TagInfo tagInfo) { boolean nestedSeen = false; boolean atBeginSeen = false; boolean atEndSeen = false; // Determine if there are any aliases boolean aliasSeen = false; TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); for (int i = 0; i < tagVars.length; i++) { if (tagVars[i].getNameFromAttribute() != null && tagVars[i].getNameGiven() != null) { aliasSeen = true; break; } } if (aliasSeen) { out.printil( "public void setJspContext(JspContext ctx, java.util.Map aliasMap) {"); } else { out.printil("public void setJspContext(JspContext ctx) {"); } out.pushIndent(); out.printil("super.setJspContext(ctx);"); out.printil("java.util.ArrayList<String> _jspx_nested = null;"); out.printil("java.util.ArrayList<String> _jspx_at_begin = null;"); out.printil("java.util.ArrayList<String> _jspx_at_end = null;"); for (int i = 0; i < tagVars.length; i++) { switch (tagVars[i].getScope()) { case VariableInfo.NESTED : if (!nestedSeen) { out.printil( "_jspx_nested = new java.util.ArrayList<String>();"); nestedSeen = true; } out.printin("_jspx_nested.add("); break; case VariableInfo.AT_BEGIN : if (!atBeginSeen) { out.printil( "_jspx_at_begin = new java.util.ArrayList<String>();"); atBeginSeen = true; } out.printin("_jspx_at_begin.add("); break; case VariableInfo.AT_END : if (!atEndSeen) { out.printil( "_jspx_at_end = new java.util.ArrayList<String>();"); atEndSeen = true; } out.printin("_jspx_at_end.add("); break; } // switch out.print(quote(tagVars[i].getNameGiven())); out.println(");"); } if (aliasSeen) { out.printil( "this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, aliasMap);"); } else { out.printil( "this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);"); } out.popIndent(); out.printil("}"); out.println(); out.printil("public JspContext getJspContext() {"); out.pushIndent(); out.printil("return this.jspContext;"); out.popIndent(); out.printil("}"); }
Example 15
Source File: TagFileProcessor.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override public void visit(Node.VariableDirective n) throws JasperException { JspUtil.checkAttributes("Variable directive", n, variableDirectiveAttrs, err); String nameGiven = n.getAttributeValue("name-given"); String nameFromAttribute = n .getAttributeValue("name-from-attribute"); if (nameGiven == null && nameFromAttribute == null) { err.jspError("jsp.error.variable.either.name"); } if (nameGiven != null && nameFromAttribute != null) { err.jspError("jsp.error.variable.both.name"); } String alias = n.getAttributeValue("alias"); if (nameFromAttribute != null && alias == null || nameFromAttribute == null && alias != null) { err.jspError("jsp.error.variable.alias"); } String className = n.getAttributeValue("variable-class"); if (className == null) className = "java.lang.String"; String declareStr = n.getAttributeValue("declare"); boolean declare = true; if (declareStr != null) declare = JspUtil.booleanValue(declareStr); int scope = VariableInfo.NESTED; String scopeStr = n.getAttributeValue("scope"); if (scopeStr != null) { if ("NESTED".equals(scopeStr)) { // Already the default } else if ("AT_BEGIN".equals(scopeStr)) { scope = VariableInfo.AT_BEGIN; } else if ("AT_END".equals(scopeStr)) { scope = VariableInfo.AT_END; } } if (nameFromAttribute != null) { /* * An alias has been specified. We use 'nameGiven' to hold the * value of the alias, and 'nameFromAttribute' to hold the name * of the attribute whose value (at invocation-time) denotes the * name of the variable that is being aliased */ nameGiven = alias; checkUniqueName(nameFromAttribute, VAR_NAME_FROM, n); checkUniqueName(alias, VAR_ALIAS, n); } else { // name-given specified checkUniqueName(nameGiven, VAR_NAME_GIVEN, n); } variableVector.addElement(new TagVariableInfo(nameGiven, nameFromAttribute, className, declare, scope)); }
Example 16
Source File: Generator.java From tomcatsrc with Apache License 2.0 | 4 votes |
private void generateSetJspContext(TagInfo tagInfo) { boolean nestedSeen = false; boolean atBeginSeen = false; boolean atEndSeen = false; // Determine if there are any aliases boolean aliasSeen = false; TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); for (int i = 0; i < tagVars.length; i++) { if (tagVars[i].getNameFromAttribute() != null && tagVars[i].getNameGiven() != null) { aliasSeen = true; break; } } if (aliasSeen) { out.printil("public void setJspContext(javax.servlet.jsp.JspContext ctx, java.util.Map aliasMap) {"); } else { out.printil("public void setJspContext(javax.servlet.jsp.JspContext ctx) {"); } out.pushIndent(); out.printil("super.setJspContext(ctx);"); out.printil("java.util.ArrayList _jspx_nested = null;"); out.printil("java.util.ArrayList _jspx_at_begin = null;"); out.printil("java.util.ArrayList _jspx_at_end = null;"); for (int i = 0; i < tagVars.length; i++) { switch (tagVars[i].getScope()) { case VariableInfo.NESTED: if (!nestedSeen) { out.printil("_jspx_nested = new java.util.ArrayList();"); nestedSeen = true; } out.printin("_jspx_nested.add("); break; case VariableInfo.AT_BEGIN: if (!atBeginSeen) { out.printil("_jspx_at_begin = new java.util.ArrayList();"); atBeginSeen = true; } out.printin("_jspx_at_begin.add("); break; case VariableInfo.AT_END: if (!atEndSeen) { out.printil("_jspx_at_end = new java.util.ArrayList();"); atEndSeen = true; } out.printin("_jspx_at_end.add("); break; } // switch out.print(quote(tagVars[i].getNameGiven())); out.println(");"); } if (aliasSeen) { out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, aliasMap);"); } else { out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);"); } out.popIndent(); out.printil("}"); out.println(); out.printil("public javax.servlet.jsp.JspContext getJspContext() {"); out.pushIndent(); out.printil("return this.jspContext;"); out.popIndent(); out.printil("}"); }
Example 17
Source File: TagFileProcessor.java From packagedrone with Eclipse Public License 1.0 | 4 votes |
public void visit(Node.VariableDirective n) throws JasperException { JspUtil.checkAttributes("Variable directive", n, variableDirectiveAttrs, err); String nameGiven = n.getAttributeValue("name-given"); String nameFromAttribute = n.getAttributeValue("name-from-attribute"); if (nameGiven == null && nameFromAttribute == null) { err.jspError("jsp.error.variable.either.name"); } if (nameGiven != null && nameFromAttribute != null) { err.jspError("jsp.error.variable.both.name"); } String alias = n.getAttributeValue("alias"); if (nameFromAttribute != null && alias == null || nameFromAttribute == null && alias != null) { err.jspError("jsp.error.variable.alias"); } String className = n.getAttributeValue("variable-class"); if (className == null) className = "java.lang.String"; String declareStr = n.getAttributeValue("declare"); boolean declare = true; if (declareStr != null) declare = JspUtil.booleanValue(declareStr); int scope = VariableInfo.NESTED; String scopeStr = n.getAttributeValue("scope"); if (scopeStr != null) { if ("NESTED".equals(scopeStr)) { // Already the default } else if ("AT_BEGIN".equals(scopeStr)) { scope = VariableInfo.AT_BEGIN; } else if ("AT_END".equals(scopeStr)) { scope = VariableInfo.AT_END; } } if (nameFromAttribute != null) { /* * An alias has been specified. We use 'nameGiven' to hold the * value of the alias, and 'nameFromAttribute' to hold the * name of the attribute whose value (at invocation-time) * denotes the name of the variable that is being aliased */ nameGiven = alias; checkUniqueName(nameFromAttribute, Name.VAR_NAME_FROM, n); checkUniqueName(alias, Name.VAR_ALIAS, n); } else { // name-given specified checkUniqueName(nameGiven, Name.VAR_NAME_GIVEN, n); } variableVector.add(new TagVariableInfo( nameGiven, nameFromAttribute, className, declare, scope)); }
Example 18
Source File: Generator.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
private void generateSetJspContext(TagInfo tagInfo) { boolean nestedSeen = false; boolean atBeginSeen = false; boolean atEndSeen = false; // Determine if there are any aliases boolean aliasSeen = false; TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); for (int i = 0; i < tagVars.length; i++) { if (tagVars[i].getNameFromAttribute() != null && tagVars[i].getNameGiven() != null) { aliasSeen = true; break; } } if (aliasSeen) { out.printil("public void setJspContext(javax.servlet.jsp.JspContext ctx, java.util.Map aliasMap) {"); } else { out.printil("public void setJspContext(javax.servlet.jsp.JspContext ctx) {"); } out.pushIndent(); out.printil("super.setJspContext(ctx);"); out.printil("java.util.ArrayList _jspx_nested = null;"); out.printil("java.util.ArrayList _jspx_at_begin = null;"); out.printil("java.util.ArrayList _jspx_at_end = null;"); for (int i = 0; i < tagVars.length; i++) { switch (tagVars[i].getScope()) { case VariableInfo.NESTED: if (!nestedSeen) { out.printil("_jspx_nested = new java.util.ArrayList();"); nestedSeen = true; } out.printin("_jspx_nested.add("); break; case VariableInfo.AT_BEGIN: if (!atBeginSeen) { out.printil("_jspx_at_begin = new java.util.ArrayList();"); atBeginSeen = true; } out.printin("_jspx_at_begin.add("); break; case VariableInfo.AT_END: if (!atEndSeen) { out.printil("_jspx_at_end = new java.util.ArrayList();"); atEndSeen = true; } out.printin("_jspx_at_end.add("); break; } // switch out.print(quote(tagVars[i].getNameGiven())); out.println(");"); } if (aliasSeen) { out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, aliasMap);"); } else { out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);"); } out.popIndent(); out.printil("}"); out.println(); out.printil("public javax.servlet.jsp.JspContext getJspContext() {"); out.pushIndent(); out.printil("return this.jspContext;"); out.popIndent(); out.printil("}"); }
Example 19
Source File: Generator.java From Tomcat8-Source-Read with MIT License | 4 votes |
private void generateSetJspContext(TagInfo tagInfo) { boolean nestedSeen = false; boolean atBeginSeen = false; boolean atEndSeen = false; // Determine if there are any aliases boolean aliasSeen = false; TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); for (int i = 0; i < tagVars.length; i++) { if (tagVars[i].getNameFromAttribute() != null && tagVars[i].getNameGiven() != null) { aliasSeen = true; break; } } if (aliasSeen) { out.printil("public void setJspContext(javax.servlet.jsp.JspContext ctx, java.util.Map aliasMap) {"); } else { out.printil("public void setJspContext(javax.servlet.jsp.JspContext ctx) {"); } out.pushIndent(); out.printil("super.setJspContext(ctx);"); out.printil("java.util.ArrayList _jspx_nested = null;"); out.printil("java.util.ArrayList _jspx_at_begin = null;"); out.printil("java.util.ArrayList _jspx_at_end = null;"); for (int i = 0; i < tagVars.length; i++) { switch (tagVars[i].getScope()) { case VariableInfo.NESTED: if (!nestedSeen) { out.printil("_jspx_nested = new java.util.ArrayList();"); nestedSeen = true; } out.printin("_jspx_nested.add("); break; case VariableInfo.AT_BEGIN: if (!atBeginSeen) { out.printil("_jspx_at_begin = new java.util.ArrayList();"); atBeginSeen = true; } out.printin("_jspx_at_begin.add("); break; case VariableInfo.AT_END: if (!atEndSeen) { out.printil("_jspx_at_end = new java.util.ArrayList();"); atEndSeen = true; } out.printin("_jspx_at_end.add("); break; } // switch out.print(quote(tagVars[i].getNameGiven())); out.println(");"); } if (aliasSeen) { out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(this, ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, aliasMap);"); } else { out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(this, ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);"); } out.popIndent(); out.printil("}"); out.println(); out.printil("public javax.servlet.jsp.JspContext getJspContext() {"); out.pushIndent(); out.printil("return this.jspContext;"); out.popIndent(); out.printil("}"); }
Example 20
Source File: SessionContextTei.java From unitime with Apache License 2.0 | 4 votes |
public VariableInfo [] getVariableInfo(TagData data) { return new VariableInfo[] { new VariableInfo("sessionContext", SessionContext.class.getName(), true, VariableInfo.AT_BEGIN) }; }