1/*2 * This file was automatically generated by Apache Tiles Autotag.3 */4package org.apache.tiles.freemarker.template;
56import java.io.IOException;
7import java.util.Map;
89import org.apache.tiles.autotag.core.runtime.ModelBody;
10import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
1112import freemarker.core.Environment;
13import freemarker.template.TemplateDirectiveBody;
14import freemarker.template.TemplateDirectiveModel;
15import freemarker.template.TemplateException;
16import freemarker.template.TemplateModel;
1718/**19 * <p>20 * <strong>Inserts the value of an attribute into the page.</strong>21 * </p>22 * <p>23 * This tag can be flexibly used to insert the value of an attribute into a24 * page. As in other usages in Tiles, every attribute can be determined to have25 * a "type", either set explicitly when it was defined, or "computed". If the26 * type is not explicit, then if the attribute value is a valid definition, it27 * will be inserted as such. Otherwise, if it begins with a "/" character, it28 * will be treated as a "template". Finally, if it has not otherwise been29 * assigned a type, it will be treated as a String and included without any30 * special handling.31 * </p>32 * 33 * <p>34 * <strong>Example : </strong>35 * </p>36 * 37 * <pre>38 * <code>39 * <tiles:insertAttribute name="body" />40 * </code>41 * </pre>42 */43publicclassInsertAttributeFMModelimplements TemplateDirectiveModel {
4445/**46 * The template model.47 */48private org.apache.tiles.template.InsertAttributeModel model;
4950/**51 * Constructor.52 *53 * @param model54 * The template model.55 */56publicInsertAttributeFMModel(org.apache.tiles.template.InsertAttributeModel model) {
57this.model = model;
58 }
5960/** {@inheritDoc} */61 @SuppressWarnings("unchecked")
62 @Override
63publicvoid execute(Environment env, @SuppressWarnings("rawtypes") Map params, TemplateModel[] loopVars,
64 TemplateDirectiveBody body) throws TemplateException, IOException {
65 AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.freemarker.autotag.FreemarkerAutotagRuntime();
66if (runtime instanceof TemplateDirectiveModel) {
67 ((TemplateDirectiveModel) runtime).execute(env, params, loopVars, body);
68 }
69 org.apache.tiles.request.Request request = runtime.createRequest();
70 ModelBody modelBody = runtime.createModelBody();
71 model.execute(
72 runtime.getParameter("ignore", java.lang.Boolean.class, false),
73 runtime.getParameter("preparer", java.lang.String.class, null),
74 runtime.getParameter("role", java.lang.String.class, null),
75 runtime.getParameter("defaultValue", java.lang.Object.class, null),
76 runtime.getParameter("defaultValueRole", java.lang.String.class, null),
77 runtime.getParameter("defaultValueType", java.lang.String.class, null),
78 runtime.getParameter("name", java.lang.String.class, null),
79 runtime.getParameter("value", org.apache.tiles.Attribute.class, null),
80 runtime.getParameter("flush", java.lang.Boolean.class, false),
81 request, modelBody
82 );
83 }
84 }