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

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

?? velocitylayoutform.java

?? 這是我自己開發的一個MVC框架
?? JAVA
字號:
package dark.web.frame.velocity.form;

import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.velocity.Template;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;

/**
 * <p>Title:            </p>
 * <p>Description:      根據org.apache.velocity.servlet.VelocityLayoutServlet修改
 * 						以使dwf中的Form支持Velocity的Layout管理</p>
 * <p>Copyright:        Copyright (c) 2005</p>
 * <p>Company:          DIS</p>
 * <p>Create Time:      2005-3-4 3:02:46</p>
 * @author             <a href="mailto:dark_he@hotmail.com">darkhe</a>
 * @version            1.0
 */
public abstract class VelocityLayoutForm extends VelocityForm
{
	/**
	 * The context/parameter key used to specify an alternate
	 * layout to be used for a request instead of the default layout.
	 */
	public static String KEY_LAYOUT = "layout";
		
	/**
	 * The context key that will hold the content of the screen.
	 * 
	 * This key ($screen_content) must be present in the layout
	 * template for the current screen to be rendered.
	 */
	public static String KEY_SCREEN_CONTENT = "screen_content";	
	
	/**
	 * The context key that holds the {@link Throwable} that
	 * broke the rendering of the requested screen.
	 */
	public static String KEY_ERROR_CAUSE = "error_cause";

	/**
	 * The context key that holds the stack trace of the error that
	 * broke the rendering of the requested screen.
	 */
	public static String KEY_ERROR_STACKTRACE = "stack_trace";

	/**
	 * The context key that holds the {@link MethodInvocationException} 
	 * that broke the rendering of the requested screen.
	 *
	 * If this value is placed in the context, then $error_cause
	 * will hold the error that this invocation exception is wrapping.
	 */
	public static String KEY_ERROR_INVOCATION_EXCEPTION = "invocation_exception";
		
	private String errorTemplate;
	private String layoutDir;
	private String defaultLayout;
	
	/**
	  * Overrides VelocityViewServlet to check the request for 
	  * an alternate layout
	  *
	  * @param request client request
	  * @param response client response
	  * @return the Context to fill
	  */
	protected Context createContext(
		HttpServletRequest request,
		HttpServletResponse response)
	{

		Context ctx = super.createContext(request, response);

		// check if an alternate layout has been specified 
		// by way of the request parameters
		String layout = request.getParameter(KEY_LAYOUT);
		if (layout != null)
		{
			// let the template know what its new layout is
			ctx.put(KEY_LAYOUT, layout);
		}
		return ctx;
	}

	/**
	 * Overrides VelocityViewServlet.mergeTemplate to do a two-pass 
	 * render for handling layouts
	 */
	protected void mergeTemplate(
		Template template,
		Context context,
		HttpServletResponse response)
		throws
			ResourceNotFoundException,
			ParseErrorException,
			MethodInvocationException,
			IOException,
			UnsupportedEncodingException,
			Exception
	{
		//
		// this section is based on Tim Colson's "two pass render"
		//
		// Render the screen content
		StringWriter sw = new StringWriter();
		template.merge(context, sw);
		// Add the resulting content to the context
		context.put(KEY_SCREEN_CONTENT, sw.toString());

		// Check for an alternate layout
		//
		// we check after merging the screen template so the screen 
		// can overrule any layout set in the request parameters
		// by doing #set( $layout = "MyLayout.vm" )
		Object obj = context.get(KEY_LAYOUT);
		String layout = (obj == null) ? null : obj.toString();
		if (layout == null)
		{
			// no alternate, use default
			layout = defaultLayout;
		}
		else
		{
			// make it a full(er) path
			layout = layoutDir + layout;
		}

		try
		{
			//load the layout template
			template = getTemplate(layout);
		}
		catch (Exception e)
		{
			Velocity.error(
				"VelocityLayoutCommand: Can't load layout \""
					+ layout
					+ "\": "
					+ e);

			// if it was an alternate layout we couldn't get...
			if (!layout.equals(defaultLayout))
			{
				// try to get the default layout
				// if this also fails, let the exception go
				template = getTemplate(defaultLayout);
			}
		}

		// Render the layout template into the response
		super.mergeTemplate(template, context, response);
	}

	/**
	 * Overrides VelocityViewServlet to display user's custom error template
	 */
	protected void error(
		HttpServletRequest request,
		HttpServletResponse response,
		Exception e)
		throws ServletException
	{
		try
		{
			// get a velocity context
			Context ctx = createContext(request, response);

			Throwable cause = e;

			// if it's an MIE, i want the real cause and stack trace!
			if (cause instanceof MethodInvocationException)
			{
				// put the invocation exception in the context
				ctx.put(KEY_ERROR_INVOCATION_EXCEPTION, e);
				// get the real cause
				cause = ((MethodInvocationException) e).getWrappedThrowable();
			}

			// add the cause to the context
			ctx.put(KEY_ERROR_CAUSE, cause);

			// grab the cause's stack trace and put it in the context
			StringWriter sw = new StringWriter();
			cause.printStackTrace(new java.io.PrintWriter(sw));
			ctx.put(KEY_ERROR_STACKTRACE, sw.toString());

			// retrieve and render the error template
			Template et = getTemplate(errorTemplate);
			mergeTemplate(et, ctx, response);

		}
		catch (Exception e2)
		{
			// d'oh! log this
			Velocity.error(
				"VelocityLayoutCommand: "
					+ " Error during error template rendering - "
					+ e2);
			// then punt the original to a higher authority
			super.error(request, response, e);
		}
	}

	/**
	 * @return
	 */
	public String getDefaultLayout()
	{
		return defaultLayout;
	}

	/**
	 * @param string
	 */
	public void setDefaultLayout(String string)
	{
		defaultLayout = string;
	}

	/**
	 * @return
	 */
	public String getErrorTemplate()
	{
		return errorTemplate;
	}

	/**
	 * @return
	 */
	public String getLayoutDir()
	{
		return layoutDir;
	}

	/**
	 * @param string
	 */
	public void setErrorTemplate(String string)
	{
		errorTemplate = string;
	}

	/**
	 * @param string
	 */
	public void setLayoutDir(String string)
	{
		layoutDir = string;
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美高清性hdvideosex| 99麻豆久久久国产精品免费 | 欧美电视剧在线看免费| 欧美午夜精品理论片a级按摩| 国产成人免费在线| 国产高清久久久| 精品亚洲国内自在自线福利| 久久精品99久久久| 成人高清免费观看| 成人在线综合网站| av在线这里只有精品| 色综合中文字幕国产 | 99久久99久久综合| 99久精品国产| 欧美曰成人黄网| 欧美亚洲日本一区| 91麻豆精品国产无毒不卡在线观看| 日韩视频不卡中文| 亚洲激情第一区| 亚洲国产精品ⅴa在线观看| 欧美精品一区二区久久久| 精品国产区一区| 久久精品在线免费观看| 国产精品看片你懂得| 综合激情网...| 天天色天天爱天天射综合| 日本视频中文字幕一区二区三区| 老司机精品视频一区二区三区| 久久99精品久久只有精品| 国产黄人亚洲片| 91理论电影在线观看| 欧美丰满一区二区免费视频| 日韩欧美国产三级| 中文字幕av不卡| 一区二区日韩av| 国产一区91精品张津瑜| 91麻豆免费看片| 91精品国产综合久久久久久久久久 | 在线电影国产精品| 久久久久久久久岛国免费| 亚洲美女淫视频| 精品一区二区国语对白| 91麻豆国产在线观看| 精品美女在线观看| 亚洲自拍欧美精品| 粉嫩av一区二区三区粉嫩| 欧美性videosxxxxx| 精品国产乱码久久久久久浪潮| 亚洲精品视频在线观看免费| 男人的天堂亚洲一区| 色婷婷精品久久二区二区蜜臀av| 欧美成人video| 亚洲成人在线网站| 不卡一卡二卡三乱码免费网站 | 亚洲国产你懂的| 成人教育av在线| 日韩欧美国产综合| 亚洲地区一二三色| 91丨porny丨户外露出| 久久久久久久综合色一本| 日韩综合小视频| 91丨国产丨九色丨pron| 欧美国产精品一区二区三区| 美国十次综合导航| 欧美精品18+| 亚洲一区二区在线观看视频| 波多野结衣亚洲| 2020国产精品| 国内久久精品视频| 日韩视频免费观看高清在线视频| 夜夜爽夜夜爽精品视频| 91小视频在线免费看| 综合精品久久久| 99久久er热在这里只有精品66| 国产精品婷婷午夜在线观看| 国产黑丝在线一区二区三区| 久久久久99精品国产片| 国产一区二区女| 精品福利一区二区三区免费视频| 日本一区中文字幕| 91精品国产手机| 日韩精品一二三四| 欧美白人最猛性xxxxx69交| 免费观看在线综合| 精品国产乱码久久| 国产一区二区不卡在线| 精品国产sm最大网站| 精品一区二区国语对白| 久久久99精品久久| av不卡免费电影| 亚洲乱码精品一二三四区日韩在线 | 日韩中文字幕麻豆| 欧美一区二区在线免费观看| 免费高清在线一区| 久久午夜色播影院免费高清| 成人免费视频播放| 亚洲精品免费电影| 7777精品伊人久久久大香线蕉最新版| 日韩一区精品视频| 久久青草欧美一区二区三区| 国产精品夜夜嗨| 综合欧美一区二区三区| 欧美日韩国产综合一区二区三区 | 7777精品伊人久久久大香线蕉完整版 | 成人欧美一区二区三区视频网页| www.亚洲色图| 天堂va蜜桃一区二区三区漫画版| 欧美zozo另类异族| 色视频一区二区| 日韩国产精品久久| 国产午夜精品一区二区| 欧美性受xxxx| 国内精品免费**视频| 亚洲精品videosex极品| 欧美电影免费观看高清完整版| 成人黄色777网| 五月天激情综合| 国产精品久99| 日韩欧美国产系列| 色琪琪一区二区三区亚洲区| 精品无码三级在线观看视频| 亚洲免费三区一区二区| 欧美精品一区二区三区在线| 色综合咪咪久久| 国产成人免费视频网站| 午夜欧美电影在线观看| 国产精品福利一区二区| 日韩一区二区在线观看| www.在线成人| 精品亚洲国产成人av制服丝袜| 亚洲精品免费播放| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 亚洲福利一二三区| 中文字幕精品三区| 欧美成人a∨高清免费观看| 色婷婷精品大在线视频| 丰满放荡岳乱妇91ww| 青青青爽久久午夜综合久久午夜 | 欧美亚洲国产一区在线观看网站| 精品一区二区三区香蕉蜜桃 | 91精品国产福利在线观看| 99久久综合色| 成人少妇影院yyyy| 国产传媒一区在线| 国产一区二三区| 国内精品视频666| 精品一区二区三区欧美| 日本不卡一二三| 婷婷综合另类小说色区| 亚洲二区视频在线| 亚洲一区二区三区爽爽爽爽爽| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 欧美专区亚洲专区| 91美女在线视频| 色悠悠久久综合| 色综合中文字幕| 在线一区二区三区四区五区| 色综合天天综合网天天看片| 99久久精品国产精品久久| 99久久精品国产观看| 91视频一区二区| 日本道色综合久久| 精品1区2区3区| 欧美精品乱码久久久久久按摩 | 国产在线一区观看| 国产麻豆精品视频| 色欧美片视频在线观看| 日本精品一区二区三区四区的功能| 99视频精品免费视频| 91久久免费观看| 欧美日韩国产大片| 欧美大片一区二区| 久久久亚洲综合| 亚洲欧美自拍偷拍| 一二三区精品福利视频| 奇米影视一区二区三区小说| 九一久久久久久| 99久久免费精品高清特色大片| 91色九色蝌蚪| 日韩欧美亚洲国产另类| 欧美韩日一区二区三区四区| 亚洲欧美经典视频| 免费成人av资源网| 成人理论电影网| 欧美精品一二三| 久久精品网站免费观看| 亚洲综合视频网| 麻豆成人91精品二区三区| 成人福利视频在线| 91精品国产色综合久久不卡电影| 久久亚洲精品小早川怜子| 一区二区三区自拍| 国产曰批免费观看久久久| 色妞www精品视频| 日韩免费电影网站| 一区二区三区电影在线播| 精彩视频一区二区| 在线观看91视频| 久久精品亚洲精品国产欧美kt∨| 亚洲精品中文在线观看|