All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tiles.freemarker.template.InsertAttributeFMModel Maven / Gradle / Ivy

/*
 * This file was automatically generated by Apache Tiles Autotag.
 */
package org.apache.tiles.freemarker.template;

import java.io.IOException;
import java.util.Map;

import org.apache.tiles.autotag.core.runtime.ModelBody;
import org.apache.tiles.autotag.core.runtime.AutotagRuntime;

import freemarker.core.Environment;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;

/**
 * 

* Inserts the value of an attribute into the page. *

*

* This tag can be flexibly used to insert the value of an attribute into a * page. As in other usages in Tiles, every attribute can be determined to have * a "type", either set explicitly when it was defined, or "computed". If the * type is not explicit, then if the attribute value is a valid definition, it * will be inserted as such. Otherwise, if it begins with a "/" character, it * will be treated as a "template". Finally, if it has not otherwise been * assigned a type, it will be treated as a String and included without any * special handling. *

* *

* Example : *

* *
 * <code>
 *           <tiles:insertAttribute name="body" />
 *         </code>
 * 
*/ public class InsertAttributeFMModel implements TemplateDirectiveModel { /** * The template model. */ private org.apache.tiles.template.InsertAttributeModel model; /** * Constructor. * * @param model * The template model. */ public InsertAttributeFMModel(org.apache.tiles.template.InsertAttributeModel model) { this.model = model; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void execute(Environment env, @SuppressWarnings("rawtypes") Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { AutotagRuntime runtime = new org.apache.tiles.request.freemarker.autotag.FreemarkerAutotagRuntime(); if (runtime instanceof TemplateDirectiveModel) { ((TemplateDirectiveModel) runtime).execute(env, params, loopVars, body); } org.apache.tiles.request.Request request = runtime.createRequest(); ModelBody modelBody = runtime.createModelBody(); model.execute( runtime.getParameter("ignore", java.lang.Boolean.class, false), runtime.getParameter("preparer", java.lang.String.class, null), runtime.getParameter("role", java.lang.String.class, null), runtime.getParameter("defaultValue", java.lang.Object.class, null), runtime.getParameter("defaultValueRole", java.lang.String.class, null), runtime.getParameter("defaultValueType", java.lang.String.class, null), runtime.getParameter("name", java.lang.String.class, null), runtime.getParameter("value", org.apache.tiles.Attribute.class, null), runtime.getParameter("flush", java.lang.Boolean.class, false), request, modelBody ); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy