List of usage examples for javax.servlet.jsp.tagext VariableInfo AT_END
int AT_END
To view the source code for javax.servlet.jsp.tagext VariableInfo AT_END.
Click Source Link
From source file:com.germinus.easyconf.taglib.PropertyTei.java
/** * Return information about the scripting variables to be created. *//* w ww. j a v a2s. c o m*/ public VariableInfo[] getVariableInfo(TagData data) { String type = (String) data.getAttribute("type"); if (StringUtils.isEmpty(type)) { type = "java.lang.String"; } return new VariableInfo[] { new VariableInfo(data.getAttributeString("id"), type, true, VariableInfo.AT_END) }; }
From source file:com.gisgraphy.webapp.taglib.ConstantsTei.java
/** * Return information about the scripting variables to be created. * /* ww w. j a va2 s . co m*/ * @param data * the input data * @return VariableInfo array of variable information */ @Override public VariableInfo[] getVariableInfo(TagData data) { // loop through and expose all attributes List<VariableInfo> vars = new ArrayList<VariableInfo>(); try { String clazz = data.getAttributeString("className"); if (clazz == null) { clazz = Constants.class.getName(); } Class<?> c = Class.forName(clazz); // if no var specified, get all if (data.getAttributeString("var") == null) { Field[] fields = c.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (Field field : fields) { String type = field.getType().getName(); vars.add(new VariableInfo(field.getName(), ((field.getType().isArray()) ? type.substring(2, type.length() - 1) + "[]" : type), true, VariableInfo.AT_END)); } } else { String var = data.getAttributeString("var"); String type = c.getField(var).getType().getName(); vars.add(new VariableInfo(c.getField(var).getName(), ((c.getField(var).getType().isArray()) ? type.substring(2, type.length() - 1) + "[]" : type), true, VariableInfo.AT_END)); } } catch (Exception cnf) { log.error(cnf.getMessage()); } return vars.toArray(new VariableInfo[] {}); }
From source file:alpha.portal.webapp.taglib.ConstantsTei.java
/** * Return information about the scripting variables to be created. * // ww w. j ava 2s . c o m * @param data * the input data * @return VariableInfo array of variable information */ @Override public VariableInfo[] getVariableInfo(final TagData data) { // loop through and expose all attributes final List<VariableInfo> vars = new ArrayList<VariableInfo>(); try { String clazz = data.getAttributeString("className"); if (clazz == null) { clazz = Constants.class.getName(); } final Class c = Class.forName(clazz); // if no var specified, get all if (data.getAttributeString("var") == null) { final Field[] fields = c.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (final Field field : fields) { final String type = field.getType().getName(); vars.add(new VariableInfo(field.getName(), ((field.getType().isArray()) ? type.substring(2, type.length() - 1) + "[]" : type), true, VariableInfo.AT_END)); } } else { final String var = data.getAttributeString("var"); final String type = c.getField(var).getType().getName(); vars.add(new VariableInfo(c.getField(var).getName(), ((c.getField(var).getType().isArray()) ? type.substring(2, type.length() - 1) + "[]" : type), true, VariableInfo.AT_END)); } } catch (final Exception cnf) { this.log.error(cnf.getMessage()); cnf.printStackTrace(); } return vars.toArray(new VariableInfo[] {}); }
From source file:org.apache.jasper.compiler.TagLibraryInfoImpl.java
TagVariableInfo createVariable(TreeNode elem) { String nameGiven = null;/*from www .j a v a2 s.c o 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 at end of tag file *///from w w w . j a v a 2s .c o m 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) *//*from w ww . ja v a2 s . com*/ 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.musicrecital.webapp.taglib.ConstantsTei.java
/** * Return information about the scripting variables to be created. * @param data the input data//from w ww . ja va 2s .co m * @return VariableInfo array of variable information */ public VariableInfo[] getVariableInfo(TagData data) { // loop through and expose all attributes List<VariableInfo> vars = new ArrayList<VariableInfo>(); try { String clazz = data.getAttributeString("className"); if (clazz == null) { clazz = Constants.class.getName(); } Class c = Class.forName(clazz); // if no var specified, get all if (data.getAttributeString("var") == null) { Field[] fields = c.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (Field field : fields) { String type = field.getType().getName(); vars.add(new VariableInfo(field.getName(), ((field.getType().isArray()) ? type.substring(2, type.length() - 1) + "[]" : type), true, VariableInfo.AT_END)); } } else { String var = data.getAttributeString("var"); String type = c.getField(var).getType().getName(); vars.add(new VariableInfo(c.getField(var).getName(), ((c.getField(var).getType().isArray()) ? type.substring(2, type.length() - 1) + "[]" : type), true, VariableInfo.AT_END)); } } catch (Exception cnf) { log.error(cnf.getMessage()); cnf.printStackTrace(); } return vars.toArray(new VariableInfo[] {}); }
From source file:org.openhie.openempi.webapp.taglib.ConstantsTei.java
/** * Return information about the scripting variables to be created. * @param data the input data/*from w w w . jav a 2 s.c o m*/ * @return VariableInfo array of variable information */ @SuppressWarnings("unchecked") public VariableInfo[] getVariableInfo(TagData data) { // loop through and expose all attributes List<VariableInfo> vars = new ArrayList<VariableInfo>(); try { String clazz = data.getAttributeString("className"); if (clazz == null) { clazz = Constants.class.getName(); } Class c = Class.forName(clazz); // if no var specified, get all if (data.getAttributeString("var") == null) { Field[] fields = c.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (Field field : fields) { String type = field.getType().getName(); vars.add(new VariableInfo(field.getName(), ((field.getType().isArray()) ? type.substring(2, type.length() - 1) + "[]" : type), true, VariableInfo.AT_END)); } } else { String var = data.getAttributeString("var"); String type = c.getField(var).getType().getName(); vars.add(new VariableInfo(c.getField(var).getName(), ((c.getField(var).getType().isArray()) ? type.substring(2, type.length() - 1) + "[]" : type), true, VariableInfo.AT_END)); } } catch (Exception cnf) { log.error(cnf.getMessage()); cnf.printStackTrace(); } return vars.toArray(new VariableInfo[] {}); }
From source file:org.tinygroup.jspengine.compiler.TagLibraryInfoImpl.java
private TagVariableInfo createVariable(TreeNode elem) throws JasperException { String nameGiven = null;// w w w . j av 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); }
From source file:ubic.gemma.web.taglib.ConstantsTei.java
/** * Return information about the scripting variables to be created. *//*from w w w . j a v a 2 s.c o m*/ @Override public VariableInfo[] getVariableInfo(TagData data) { // loop through and expose all attributes List<VariableInfo> vars = new ArrayList<VariableInfo>(); try { String clazz = data.getAttributeString("className"); if (clazz == null) { clazz = Constants.class.getName(); } Class<?> c = Class.forName(clazz); // if no var specified, get all if (data.getAttributeString("var") == null) { Field[] fields = c.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (int i = 0; i < fields.length; i++) { vars.add(new VariableInfo(fields[i].getName(), "java.lang.String", true, VariableInfo.AT_END)); } } else { String var = data.getAttributeString("var"); vars.add( new VariableInfo(c.getField(var).getName(), "java.lang.String", true, VariableInfo.AT_END)); } } catch (Exception cnf) { log.error(cnf.getMessage()); cnf.printStackTrace(); } return vars.toArray(new VariableInfo[] {}); }