Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
License Agreement. Rich Faces - Natural Ajax for Java Server Faces (JSF) Copyright (C) 2007 Exadel, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 package org.ajax4jsf.templatecompiler.elements.std;
Processing c:forEach-tag.

Author(s): (latest modification by $Author: alexeyyukhovich $)
$Revision: $ $Date: 2007/02/26 20:48:39 $
 public class ForEachTemplateElement extends TemplateElementBase {
 	private static int indexForCollection = 0;
 	private static final String ATTRIBUTE_FROM = "begin";
 	private static final String ATTRIBUTE_TO = "end";
 	private String strItems;
 	private String strFrom;
 	private String strTo;
 	public ForEachTemplateElement(final Node element,
 			final CompilationContext componentBean) {
 		NamedNodeMap nnm = element.getAttributes();
 		Node varItem = nnm.getNamedItem("var");
 		this. = varItem.getNodeValue();
 		Node items = nnm.getNamedItem("items");
 		if (items != null) {
 			this. = ELParser.compileEL(items.getNodeValue(), componentBean);
 		} else {
 			Node fromItem = nnm.getNamedItem();
 			Node toItem = nnm.getNamedItem();
 			this. = ELParser
 					.compileEL(fromItem.getNodeValue(), componentBean);
 			this. = ELParser.compileEL(toItem.getNodeValue(), componentBean);

 		VelocityContext context = new VelocityContext();
 		String templateName;
 			if (this. != null) {
 				templateName = getTemplate1Name();//"FORElement_1.vm");
 				context.put("index"new Integer());
 			} else {
 				templateName = getTemplate2Name();//"FORElement_2.vm");
 			return this.getComponentBean().processTemplate(templateNamecontext);

	protected String getTemplate2Name() {

	protected String getTemplate1Name() {

	public String getEndElement() {
		return "}";
New to GrepCode? Check out our FAQ X