亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? velocitylayoutview.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2006 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.web.servlet.view.velocity;

import java.io.StringWriter;

import javax.servlet.http.HttpServletResponse;

import org.apache.velocity.Template;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.ResourceNotFoundException;

import org.springframework.context.ApplicationContextException;

/**
 * VelocityLayoutView emulates the functionality offered by Velocity's
 * VelocityLayoutServlet to ease page composition from different templates.
 *
 * <p>The <code>url</code> property should be set to the content template
 * for the view, and the layout template location should be specified as
 * <code>layoutUrl</code> property. A view can override the configured
 * layout template location by setting the appropriate key (the default
 * is "layout") in the content template.
 *
 * <p>When the view is rendered, the VelocityContext is first merged with
 * the content template (specified by the <code>url</code> property) and
 * then merged with the layout template to produce the final output.
 *
 * <p>The layout template can include the screen content through a
 * VelocityContext variable (the default is "screen_content").
 * At runtime, this variable will contain the rendered content template.
 *
 * @author Darren Davison
 * @author Juergen Hoeller
 * @since 1.2
 * @see #setLayoutUrl
 * @see #setLayoutKey
 * @see #setScreenContentKey
 */
public class VelocityLayoutView extends VelocityToolboxView {

	/**
	 * The default {@link #setLayoutUrl(String) layout url}.
	 */
	public static final String DEFAULT_LAYOUT_URL = "layout.vm";

	/**
	 * The default {@link #setLayoutKey(String) layout key}.
	 */
	public static final String DEFAULT_LAYOUT_KEY = "layout";

	/**
	 * The default {@link #setScreenContentKey(String) screen content key}.
	 */
	public static final String DEFAULT_SCREEN_CONTENT_KEY = "screen_content";


	private String layoutUrl = DEFAULT_LAYOUT_URL;

	private String layoutKey = DEFAULT_LAYOUT_KEY;

	private String screenContentKey = DEFAULT_SCREEN_CONTENT_KEY;


	/**
	 * Set the layout template to use. Default is {@link #DEFAULT_LAYOUT_URL "layout.vm"}.
	 * @param layoutUrl the template location (relative to the template
	 * root directory)
	 */
	public void setLayoutUrl(String layoutUrl) {
		this.layoutUrl = layoutUrl;
	}

	/**
	 * Set the context key used to specify an alternate layout to be used instead
	 * of the default layout. Screen content templates can override the layout
	 * template that they wish to be wrapped with by setting this value in the
	 * template, for example:<br>
	 * <code>#set( $layout = "MyLayout.vm" )</code>
	 * <p>Default key is {@link #DEFAULT_LAYOUT_KEY "layout"}, as illustrated above.
	 * @param layoutKey the name of the key you wish to use in your
	 * screen content templates to override the layout template
	 */
	public void setLayoutKey(String layoutKey) {
		this.layoutKey = layoutKey;
	}

	/**
	 * Set the name of the context key that will hold the content of
	 * the screen within the layout template. This key must be present
	 * in the layout template for the current screen to be rendered.
	 * <p>Default is {@link #DEFAULT_SCREEN_CONTENT_KEY "screen_content"}:
	 * accessed in VTL as <code>$screen_content</code>.
	 * @param screenContentKey the name of the screen content key to use
	 */
	public void setScreenContentKey(String screenContentKey) {
		this.screenContentKey = screenContentKey;
	}


	/**
	 * Overrides <code>VelocityView.checkTemplate()</code> to additionally check
	 * that both the layout template and the screen content template can be loaded.
	 * Note that during rendering of the screen content, the layout template
	 * can be changed which may invalidate any early checking done here.
	 */
	protected void checkTemplate() throws ApplicationContextException {
		super.checkTemplate();

		try {
			// Check that we can get the template, even if we might subsequently get it again.
			getTemplate(this.layoutUrl);
		}
		catch (ResourceNotFoundException ex) {
			throw new ApplicationContextException("Cannot find Velocity template for URL [" + this.layoutUrl +
					"]: Did you specify the correct resource loader path?", ex);
		}
		catch (Exception ex) {
			throw new ApplicationContextException(
					"Could not load Velocity template for URL [" + this.layoutUrl + "]", ex);
		}
	}

	/**
	 * Overrides the normal rendering process in order to pre-process the Context,
	 * merging it with the screen template into a single value (identified by the
	 * value of screenContentKey). The layout template is then merged with the
	 * modified Context in the super class.
	 */
	protected void doRender(Context context, HttpServletResponse response) throws Exception {
		renderScreenContent(context);

		// Velocity context now includes any mappings that were defined
		// (via #set) in screen content template.
		// The screen template can overrule the layout by doing
		// #set( $layout = "MyLayout.vm" )
		String layoutUrlToUse = (String) context.get(this.layoutKey);
		if (layoutUrlToUse != null) {
			if (logger.isDebugEnabled()) {
				logger.debug("Screen content template has requested layout [" + layoutUrlToUse + "]");
			}
		}
		else {
			// No explicit layout URL given -> use default layout of this view.
			layoutUrlToUse = this.layoutUrl;
		}

		mergeTemplate(getTemplate(layoutUrlToUse), context, response);
	}

	/**
	 * The resulting context contains any mappings from render, plus screen content.
	 */
	private void renderScreenContent(Context velocityContext) throws Exception {
		if (logger.isDebugEnabled()) {
			logger.debug("Rendering screen content template [" + getUrl() + "]");
		}

		StringWriter sw = new StringWriter();
		Template screenContentTemplate = getTemplate(getUrl());
		screenContentTemplate.merge(velocityContext, sw);

		// Put rendered content into Velocity context.
		velocityContext.put(this.screenContentKey, sw.toString());
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
夜夜爽夜夜爽精品视频| 91麻豆精品国产91久久久 | 精品无码三级在线观看视频| 欧美精品1区2区3区| 亚洲激情成人在线| 在线视频国内自拍亚洲视频| 亚洲一区二区视频| 欧美欧美欧美欧美| 久久精品国产77777蜜臀| 精品99一区二区| 高清在线成人网| 亚洲精品高清在线| 欧美精选一区二区| 国产毛片精品视频| 国产精品久久久久久亚洲伦| 欧美综合欧美视频| 久久激情五月婷婷| 国产精品久久久久久久久免费桃花 | 亚洲成人资源在线| 精品国产91洋老外米糕| 成人亚洲一区二区一| 亚洲图片欧美一区| 亚洲精品在线观| 色婷婷精品大在线视频| 日韩国产精品大片| 国产亚洲一区二区三区四区| 91蜜桃婷婷狠狠久久综合9色| 五月开心婷婷久久| 中文字幕精品一区二区三区精品| 在线观看日韩电影| 韩国成人在线视频| 亚洲欧美日韩国产另类专区| 日韩三级av在线播放| 99视频一区二区| 蜜桃91丨九色丨蝌蚪91桃色| 国产精品久久久久婷婷| 6080亚洲精品一区二区| 99久久国产综合精品色伊| 蜜臀久久久久久久| 亚洲男人的天堂在线观看| 日韩女优毛片在线| 在线亚洲+欧美+日本专区| 国产伦精品一区二区三区视频青涩| 一区二区久久久久| 国产日韩欧美一区二区三区综合| 欧美精选一区二区| 色狠狠一区二区三区香蕉| 国产在线视频一区二区三区| 五月综合激情网| 中文字幕中文字幕一区| 2017欧美狠狠色| 欧美一区二区免费视频| 色综合中文字幕国产 | 日韩女同互慰一区二区| 日本精品一区二区三区高清| 成人午夜免费视频| 久久福利视频一区二区| 午夜欧美电影在线观看| 亚洲精品国久久99热| 国产精品久久久久久户外露出| 26uuu国产在线精品一区二区| 欧洲一区二区av| 成人免费毛片片v| 国产麻豆精品视频| 狠狠色狠狠色综合日日91app| 日日夜夜免费精品| 亚洲自拍都市欧美小说| 国产精品久久久久久久久快鸭| 精品国产乱码久久久久久影片| 欧美一级电影网站| 日韩午夜小视频| 色婷婷av一区二区三区gif| 色香色香欲天天天影视综合网| 国产传媒日韩欧美成人| 狠狠色丁香久久婷婷综| 久久成人羞羞网站| 久久精品国产亚洲高清剧情介绍| 日韩电影一区二区三区| 婷婷六月综合亚洲| 奇米在线7777在线精品| 日韩二区在线观看| 久久国产精品露脸对白| 国内精品久久久久影院色| 国产精品自产自拍| 成人黄色av电影| 91麻豆精品在线观看| 欧美性生活影院| 91精品国产全国免费观看| 777午夜精品视频在线播放| 欧美不卡视频一区| 久久久精品免费网站| 日本一区二区久久| √…a在线天堂一区| 亚洲精品久久嫩草网站秘色| 亚洲一区二区三区四区五区黄 | 国产精品少妇自拍| 亚洲丝袜精品丝袜在线| 亚洲一区二区av电影| 日韩精品一二区| 久久国产精品99久久久久久老狼| 国产真实乱偷精品视频免| 成人国产在线观看| 色94色欧美sute亚洲线路一久| 欧美精品免费视频| 26uuu亚洲综合色| 中文字幕一区二区三区四区不卡 | 欧美视频在线不卡| 91麻豆精品国产91久久久久久久久| 欧美成人国产一区二区| 国产精品每日更新| 亚洲成人福利片| 国产剧情一区二区三区| 91国偷自产一区二区三区观看 | 精品奇米国产一区二区三区| 久久久亚洲精华液精华液精华液| 亚洲人吸女人奶水| 香蕉加勒比综合久久| 国产精品1区2区3区| 91久久线看在观草草青青| 精品欧美乱码久久久久久| 国产日韩精品视频一区| 亚洲a一区二区| 国产精品1区2区3区在线观看| 欧美性生活久久| 欧美精品一区二区三区一线天视频| 中文字幕中文在线不卡住| 蜜臀av亚洲一区中文字幕| 色综合久久天天| 久久你懂得1024| 亚洲国产精品久久久男人的天堂 | 色综合色综合色综合| 日韩欧美中文字幕精品| 亚洲美女视频在线观看| 国产揄拍国内精品对白| 欧美午夜精品久久久久久超碰| 国产精品午夜久久| 久久精品99国产国产精| 欧美日韩精品一区二区三区四区| 国产欧美视频一区二区三区| 日韩国产精品91| 欧美中文字幕一区二区三区| 国产精品久久久久婷婷| 国产精品白丝jk黑袜喷水| 91精品国产综合久久蜜臀| 一区二区三区电影在线播| 国产成人av一区二区| 亚洲一区二三区| 国内精品自线一区二区三区视频| 欧美亚洲图片小说| 亚洲日本韩国一区| 国产不卡视频一区| 久久影院午夜论| 麻豆精品新av中文字幕| 欧美精品乱码久久久久久按摩| 夜夜嗨av一区二区三区中文字幕| 成人精品gif动图一区| 精品久久国产老人久久综合| 日韩 欧美一区二区三区| 欧美三级电影在线看| 伊人开心综合网| 一本一本大道香蕉久在线精品| 国产精品色哟哟网站| 不卡视频免费播放| 国产精品欧美一区喷水| 岛国av在线一区| 国产精品丝袜91| 国产mv日韩mv欧美| 欧美国产一区在线| 成人午夜在线免费| 久久久国产午夜精品| 国产成人精品亚洲日本在线桃色| 欧美成人vr18sexvr| 国产精品中文字幕日韩精品| 久久伊人蜜桃av一区二区| 韩国午夜理伦三级不卡影院| 欧美本精品男人aⅴ天堂| 精品一区免费av| 久久久精品国产免费观看同学| 国产91富婆露脸刺激对白| 国产欧美一区二区三区网站| 99久久精品一区二区| 亚洲品质自拍视频| 欧美日韩免费高清一区色橹橹| 丝袜亚洲精品中文字幕一区| 欧美一级高清大全免费观看| 国产毛片一区二区| 国产精品久久久久三级| 在线观看视频一区| 蜜桃av一区二区| 欧美高清在线视频| 在线日韩一区二区| 另类成人小视频在线| 久久免费看少妇高潮| av网站免费线看精品| 午夜久久久久久| 久久久久久久久久久黄色| 一本色道久久综合亚洲aⅴ蜜桃 | 久久久久国产一区二区三区四区 | 久久精品国产久精国产| 久久一区二区三区国产精品|