dateeditor.java

来自「校园管理系统 利用struts+hibernate+spring 学校管理者决」· Java 代码 · 共 25 行

JAVA
25
字号
package com.spring.controller;

import java.beans.PropertyEditorSupport;
import java.sql.Date;

public class DateEditor extends PropertyEditorSupport {
	public String getAsText() {
		Object o = getValue();
		if (o == null || !(o instanceof Date)) {
			return null;
		}
		return o.toString();
	}

	public void setAsText(String text) throws IllegalArgumentException {
		Date date;
		if (text != null && text != "")
			date = Date.valueOf(text);
		else
			date = new Date(System.currentTimeMillis());
		setValue(date);
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?