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

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

?? webdatabinder.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2008 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.bind;

import java.lang.reflect.Array;
import java.util.Iterator;
import java.util.Map;

import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.PropertyValue;
import org.springframework.validation.DataBinder;
import org.springframework.web.multipart.MultipartFile;

/**
 * Special {@link DataBinder} for data binding from web request parameters
 * to JavaBean objects. Designed for web environments, but not dependent on
 * the Servlet API; serves as base class for more specific DataBinder variants,
 * such as {@link org.springframework.web.bind.ServletRequestDataBinder}.
 *
 * <p>Includes support for field markers which address a common problem with
 * HTML checkboxes and select options: detecting that a field was part of
 * the form, but did not generate a request parameter because it was empty.
 * A field marker allows to detect that state and reset the corresponding
 * bean property accordingly.
 *
 * @author Juergen Hoeller
 * @since 1.2
 * @see #registerCustomEditor
 * @see #setAllowedFields
 * @see #setRequiredFields
 * @see #setFieldMarkerPrefix
 * @see ServletRequestDataBinder
 */
public class WebDataBinder extends DataBinder {

	/**
	 * Default prefix that field marker parameters start with, followed by the field
	 * name: e.g. "_subscribeToNewsletter" for a field "subscribeToNewsletter".
	 * <p>Such a marker parameter indicates that the field was visible, that is,
	 * existed in the form that caused the submission. If no corresponding field
	 * value parameter was found, the field will be reset. The value of the field
	 * marker parameter does not matter in this case; an arbitrary value can be used.
	 * This is particularly useful for HTML checkboxes and select options.
	 * @see #setFieldMarkerPrefix
	 */
	public static final String DEFAULT_FIELD_MARKER_PREFIX = "_";


	private String fieldMarkerPrefix = DEFAULT_FIELD_MARKER_PREFIX;

	private boolean bindEmptyMultipartFiles = true;


	/**
	 * Create a new WebDataBinder instance, with default object name.
	 * @param target the target object to bind onto (or <code>null</code>
	 * if the binder is just used to convert a plain parameter value)
	 * @see #DEFAULT_OBJECT_NAME
	 */
	public WebDataBinder(Object target) {
		super(target);
	}

	/**
	 * Create a new WebDataBinder instance.
	 * @param target the target object to bind onto (or <code>null</code>
	 * if the binder is just used to convert a plain parameter value)
	 * @param objectName the name of the target object
	 */
	public WebDataBinder(Object target, String objectName) {
		super(target, objectName);
	}


	/**
	 * Specify a prefix that can be used for parameters that mark potentially
	 * empty fields, having "prefix + field" as name. Such a marker parameter is
	 * checked by existence: You can send any value for it, for example "visible".
	 * This is particularly useful for HTML checkboxes and select options.
	 * <p>Default is "_", for "_FIELD" parameters (e.g. "_subscribeToNewsletter").
	 * Set this to null if you want to turn off the empty field check completely.
	 * <p>HTML checkboxes only send a value when they're checked, so it is not
	 * possible to detect that a formerly checked box has just been unchecked,
	 * at least not with standard HTML means.
	 * <p>One way to address this is to look for a checkbox parameter value if
	 * you know that the checkbox has been visible in the form, resetting the
	 * checkbox if no value found. In Spring web MVC, this typically happens
	 * in a custom <code>onBind</code> implementation.
	 * <p>This auto-reset mechanism addresses this deficiency, provided
	 * that a marker parameter is sent for each checkbox field, like
	 * "_subscribeToNewsletter" for a "subscribeToNewsletter" field.
	 * As the marker parameter is sent in any case, the data binder can
	 * detect an empty field and automatically reset its value.
	 * @see #DEFAULT_FIELD_MARKER_PREFIX
	 * @see org.springframework.web.servlet.mvc.BaseCommandController#onBind
	 */
	public void setFieldMarkerPrefix(String fieldMarkerPrefix) {
		this.fieldMarkerPrefix = fieldMarkerPrefix;
	}

	/**
	 * Return the prefix for parameters that mark potentially empty fields.
	 */
	public String getFieldMarkerPrefix() {
		return this.fieldMarkerPrefix;
	}

	/**
	 * Set whether to bind empty MultipartFile parameters. Default is "true".
	 * <p>Turn this off if you want to keep an already bound MultipartFile
	 * when the user resubmits the form without choosing a different file.
	 * Else, the already bound MultipartFile will be replaced by an empty
	 * MultipartFile holder.
	 * @see org.springframework.web.multipart.MultipartFile
	 */
	public void setBindEmptyMultipartFiles(boolean bindEmptyMultipartFiles) {
		this.bindEmptyMultipartFiles = bindEmptyMultipartFiles;
	}

	/**
	 * Return whether to bind empty MultipartFile parameters.
	 */
	public boolean isBindEmptyMultipartFiles() {
		return this.bindEmptyMultipartFiles;
	}


	/**
	 * This implementation performs a field marker check
	 * before delegating to the superclass binding process.
	 * @see #checkFieldMarkers
	 */
	protected void doBind(MutablePropertyValues mpvs) {
		checkFieldMarkers(mpvs);
		super.doBind(mpvs);
	}

	/**
	 * Check the given property values for field markers,
	 * i.e. for fields that start with the field marker prefix.
	 * <p>The existence of a field marker indicates that the specified
	 * field existed in the form. If the property values do not contain
	 * a corresponding field value, the field will be considered as empty
	 * and will be reset appropriately.
	 * @param mpvs the property values to be bound (can be modified)
	 * @see #getFieldMarkerPrefix
	 * @see #getEmptyValue(String, Class)
	 */
	protected void checkFieldMarkers(MutablePropertyValues mpvs) {
		if (getFieldMarkerPrefix() != null) {
			String fieldMarkerPrefix = getFieldMarkerPrefix();
			PropertyValue[] pvArray = mpvs.getPropertyValues();
			for (int i = 0; i < pvArray.length; i++) {
				PropertyValue pv = pvArray[i];
				if (pv.getName().startsWith(fieldMarkerPrefix)) {
					String field = pv.getName().substring(fieldMarkerPrefix.length());
					if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) {
						Class fieldType = getPropertyAccessor().getPropertyType(field);
						mpvs.addPropertyValue(field, getEmptyValue(field, fieldType));
					}
					mpvs.removePropertyValue(pv);
				}
			}
		}
	}

	/**
	 * Determine an empty value for the specified field.
	 * <p>Default implementation returns <code>Boolean.FALSE</code>
	 * for boolean fields and an empty array of array types.
	 * Else, <code>null</code> is used as default.
	 * @param field the name of the field
	 * @param fieldType the type of the field
	 * @return the empty value (for most fields: null)
	 */
	protected Object getEmptyValue(String field, Class fieldType) {
		if (fieldType != null && boolean.class.equals(fieldType) || Boolean.class.equals(fieldType)) {
			// Special handling of boolean property.
			return Boolean.FALSE;
		}
		else if (fieldType != null && fieldType.isArray()) {
			// Special handling of array property.
			return Array.newInstance(fieldType.getComponentType(), 0);
		}
		else {
			// Default value: try null.
			return null;
		}
	}


	/**
	 * Bind the multipart files contained in the given request, if any
	 * (in case of a multipart request).
	 * <p>Multipart files will only be added to the property values if they
	 * are not empty or if we're configured to bind empty multipart files too.
	 * @param multipartFiles Map of field name String to MultipartFile object
	 * @param mpvs the property values to be bound (can be modified)
	 * @see org.springframework.web.multipart.MultipartFile
	 * @see #setBindEmptyMultipartFiles
	 */
	protected void bindMultipartFiles(Map multipartFiles, MutablePropertyValues mpvs) {
		for (Iterator it = multipartFiles.entrySet().iterator(); it.hasNext();) {
			Map.Entry entry = (Map.Entry) it.next();
			String key = (String) entry.getKey();
			MultipartFile value = (MultipartFile) entry.getValue();
			if (isBindEmptyMultipartFiles() || !value.isEmpty()) {
				mpvs.addPropertyValue(key, value);
			}
		}
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
波多野结衣一区二区三区| 精品视频一区 二区 三区| 成熟亚洲日本毛茸茸凸凹| 在线观看网站黄不卡| 欧美www视频| 亚洲成a人在线观看| 不卡的av中国片| 久久综合狠狠综合久久激情| 亚洲综合在线视频| 粉嫩一区二区三区性色av| 欧美一区二区三区四区五区| 亚洲精品第1页| 成人夜色视频网站在线观看| 亚洲精品一区二区三区精华液 | 成人午夜私人影院| 日韩亚洲欧美中文三级| 亚洲va韩国va欧美va精品| 91免费国产在线观看| 亚洲国产成人自拍| 国产伦理精品不卡| 精品美女在线播放| 欧美a级理论片| 在线成人高清不卡| 亚洲一级片在线观看| 色婷婷精品久久二区二区蜜臀av| 国产欧美精品在线观看| 国产一区二区三区四区五区美女 | 色屁屁一区二区| 中文字幕日韩精品一区| 色综合久久中文综合久久97| 国产精品美女一区二区| 不卡一区二区三区四区| 中文字幕一区在线观看视频| 成人午夜短视频| 国产精品剧情在线亚洲| 国产99久久久国产精品免费看 | 精品播放一区二区| 美国一区二区三区在线播放| 精品国产一区二区三区久久久蜜月| 日韩高清一区二区| 欧美成人一级视频| 精品一区在线看| 国产日韩精品一区二区三区| 不卡av在线免费观看| 中文字幕欧美一| 欧美性猛交xxxxxx富婆| 日本午夜精品一区二区三区电影 | 日韩激情在线观看| 日韩精品在线一区| 国产成a人亚洲| 亚洲精品亚洲人成人网在线播放| 欧美图区在线视频| 久久不见久久见免费视频7 | 国产一区二区三区视频在线播放| 久久久欧美精品sm网站| 96av麻豆蜜桃一区二区| 亚洲一区二区在线视频| 日韩一级免费一区| 国产91富婆露脸刺激对白| 亚洲男人的天堂在线观看| 欧美剧情电影在线观看完整版免费励志电影 | 成人av网站免费观看| 亚洲天堂成人在线观看| 91精品欧美综合在线观看最新| 麻豆精品久久久| 亚洲视频在线一区二区| 在线播放亚洲一区| 国产精品香蕉一区二区三区| 亚洲综合在线五月| 久久亚洲欧美国产精品乐播 | 国产成人av影院| 亚洲欧美视频在线观看| 日韩一区二区三区电影 | 麻豆91精品视频| 中文在线一区二区| 欧美日韩电影在线播放| 粉嫩高潮美女一区二区三区| 亚洲bt欧美bt精品| 国产精品午夜电影| 欧美一区二区三区四区久久| 91麻豆.com| 国产在线精品一区二区| 香蕉久久夜色精品国产使用方法| 国产欧美一区二区三区鸳鸯浴| 欧美久久一二三四区| 成人av在线资源网站| 久久精品国产精品亚洲综合| 亚洲图片有声小说| 国产精品美女久久福利网站| 精品国产免费人成在线观看| 欧美综合天天夜夜久久| 成人在线视频一区二区| 老司机精品视频导航| 亚洲国产精品自拍| 亚洲四区在线观看| 国产精品麻豆视频| 久久先锋影音av鲁色资源网| 欧美国产成人精品| 欧美v日韩v国产v| 欧美一区二区三区在线电影| 精品视频在线看| 在线观看国产一区二区| 91亚洲男人天堂| 成人午夜看片网址| 国产精品18久久久久久久久久久久| 青青草成人在线观看| 日日夜夜免费精品| 亚洲一二三四久久| 一区二区三区小说| 一区二区三区高清| 一级女性全黄久久生活片免费| 中文字幕一区二区三区视频| 国产精品无圣光一区二区| 久久久www成人免费无遮挡大片| 精品少妇一区二区三区在线播放 | 国产精品福利一区二区| 久久精品夜色噜噜亚洲a∨| 精品蜜桃在线看| 久久亚区不卡日本| 久久久国产精品不卡| 国产精品三级久久久久三级| 国产精品亲子伦对白| 自拍偷自拍亚洲精品播放| 亚洲视频一区二区免费在线观看| 自拍偷拍国产亚洲| 亚洲一卡二卡三卡四卡无卡久久| 亚洲影视资源网| 日韩综合一区二区| 狠狠色综合色综合网络| 国产精品一区二区久久不卡| 福利电影一区二区三区| 91在线观看美女| 欧美色成人综合| 日韩亚洲欧美在线| 久久久久国产精品人| 中文字幕字幕中文在线中不卡视频| 一区二区三区四区国产精品| 天堂蜜桃一区二区三区| 韩国女主播一区二区三区| www.亚洲色图.com| 在线精品视频一区二区| 91精品国产高清一区二区三区蜜臀 | 国产乱人伦精品一区二区在线观看 | 成人永久免费视频| jizzjizzjizz欧美| 色狠狠色噜噜噜综合网| 91精品国产高清一区二区三区| 精品欧美一区二区三区精品久久| 欧美激情在线一区二区| 亚洲大片在线观看| 国产永久精品大片wwwapp| av午夜精品一区二区三区| 91麻豆精品国产综合久久久久久| 久久久久久亚洲综合影院红桃| 亚洲欧美日韩在线| 精品一区二区三区免费毛片爱| 99久久99精品久久久久久| 91精品国产乱码久久蜜臀| 国产精品久久久久天堂| 日韩电影一二三区| a级精品国产片在线观看| 日韩一区二区精品在线观看| 18欧美亚洲精品| 韩国女主播一区二区三区| 欧美在线视频日韩| 国产视频一区在线播放| 日韩精品乱码av一区二区| caoporn国产精品| 欧美精品一区二区三区蜜桃| 夜色激情一区二区| 国产成人亚洲精品狼色在线| 这里只有精品电影| 亚洲自拍偷拍欧美| www.欧美日韩国产在线| 久久蜜臀中文字幕| 三级欧美在线一区| 欧美最猛黑人xxxxx猛交| 国产精品国产成人国产三级| 国产一区91精品张津瑜| 欧美男男青年gay1069videost | 久久奇米777| 蜜臀久久99精品久久久画质超高清| 色欧美日韩亚洲| 国产精品女主播av| 国产成人在线观看| 久久综合久色欧美综合狠狠| 日日夜夜一区二区| 欧美日韩一区二区三区免费看| 亚洲女人小视频在线观看| 成人午夜激情影院| 中文字幕第一页久久| 国产在线播放一区二区三区| 制服丝袜国产精品| 日本系列欧美系列| 欧美一级欧美一级在线播放| 亚洲成人1区2区| 欧美性色黄大片| 亚洲高清一区二区三区| 欧美日韩国产美| 日韩av在线播放中文字幕|