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

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

?? stringutil.java

?? 這是基于 XLoadTree 的一個強大功能的展示的例子, 文件個頭也不大, 主要功能集中在 Web 前臺. 最終目標是實現一個易于使用的像 Windows 資源管理器那樣管理遠程 JSP
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
	/**
	 * 獲得指定表單域的值, 并將單個的 ' 換成 ''; SQL 規則:如果單引號中的字符串包含一個嵌入的引號, 可以使用兩個單引號表示嵌入的單引號。
	 */
	public String requestSql(HttpServletRequest request, String fieldName) {
		return replaceSql(request1(request, fieldName));
	}

	/**
	 * 根據 Cookie 名稱得到請求中的 Cookie 值, 需要事先給 _request 一個初始值; 如果 Cookie 值是 null, 則返回 ""
	 */
	public static String getCookieValue(HttpServletRequest request, String name) {
		Cookie[] cookies = request.getCookies();
		if (cookies == null) {
			return "";
		}
		for (int i = 0; i < cookies.length; i++) {
			Cookie cookie = cookies[i];
			if (cookie.getName().equals(name)) {
				// 需要對 Cookie 中的漢字進行 URL 反編碼, 適用版本: Tomcat 4.0
				return decode(cookie.getValue());
				// 不需要反編碼, 適用版本: JSWDK 1.0.1
				//return cookie.getValue();
			}
		}
		// A cookie may not return a null value, may return a ""
		return "";
	}

	// 返回指定表單名的數組
	public String[] getParameterValues(HttpServletRequest request, String name) {
		// POST 方法的參數沒有編碼錯誤
		//if (request.getMethod().equalsIgnoreCase("POST")) {
		// 文件上傳模式
		//if(isUploadMode) {
		//	return request.getParameterValues(name);
		//}
		// -- For Tomcat 4.0
		//return request.getParameterValues(name);
		// -- For JSWDK 1.0.1
		/*
		 * String values[] = _request.getParameterValues(name); if(values !=
		 * null) { for(int i = 0; i < values.length; i++) { values[i] =
		 * toChi(values[i]); } } return values;
		 */
		//}
		//else {
		// 將通過 GET 方式發送的中文字符解碼(但是必須使用 java.net.URLEncoder 進行中文字符參數的編碼)
		// 解碼時需使用內碼轉換, 也可使用反編碼, 即: return decode(_request.getParameter(name));
		// 問題: decode() 僅適用于 JDK 1.3 + Tomcat 4.0
		String encoding = request.getCharacterEncoding();

		if("GBK".equalsIgnoreCase(encoding) || "GB2312".equalsIgnoreCase(encoding)) {
			return request.getParameterValues(name);
		}

		String values[] = request.getParameterValues(name);
		if (values != null) {
			for (int i = 0; i < values.length; i++) {
				values[i] = toChi(values[i]);
			}
		}
		return values;
		//}
	}

	/**
	 * 刪除指定的 Web 應用程序目錄下所上傳的文件
	 *
	 * @param application
	 *            JSP/Servlet 的 ServletContext
	 * @param filePath
	 *            相對文件路徑
	 */
	public static void deleteFile(ServletContext application, String filePath) {
		if (!isEmpty(filePath)) {
			String physicalFilePath = application.getRealPath(filePath);
			if (!isEmpty(physicalFilePath)) {
				java.io.File file = new java.io.File(physicalFilePath);
				file.delete();
			}
		}
	}

	/**
	 * 在指定的 Web 應用程序目錄下以指定路徑創建文件
	 *
	 * @param application
	 *            JSP/Servlet 的 ServletContext
	 * @param filePath
	 *            相對文件路徑
	 */
	public static boolean createFile(ServletContext application, String filePath) {
		if (!isEmpty(filePath)) {
			String physicalFilePath = application.getRealPath(filePath);
			if (!isEmpty(physicalFilePath)) {
				java.io.File file = new java.io.File(physicalFilePath);

				try {
					// 創建文件
					return file.createNewFile();
				} catch (IOException e) {
					System.err.println("Unable to create file " + filePath);
				}
			}
		}

		return false;
	}

	/**
	 * 在指定的 Web 應用程序目錄下以指定路徑創建目錄.
	 *
	 * @param application
	 *            JSP/Servlet 的 ServletContext
	 * @param filePath
	 *            相對文件路徑
	 */
	public static boolean createDir(ServletContext application, String filePath) {
		if (!isEmpty(filePath)) {
			String physicalFilePath = application.getRealPath(filePath);
			if (!isEmpty(physicalFilePath)) {
				try {
					// 創建目錄
					java.io.File dir = new java.io.File(application
							.getRealPath(filePath));
					return dir.mkdirs();
				} catch (Exception e) {
					System.err
							.println("Unable to create directory " + filePath);
				}
			}
		}

		return false;
	}

	/**
	 * 檢查指定的 Web 應用程序目錄下的文件是否存在.
	 *
	 * @param application
	 *            JSP/Servlet 的 ServletContext
	 * @param filePath
	 *            相對文件路徑
	 * @return boolean - 文件是否存在
	 */
	public static boolean checkFileExists(ServletContext application,
			String filePath) {
		if (!isEmpty(filePath)) {
			String physicalFilePath = application.getRealPath(filePath);
			if (!isEmpty(physicalFilePath)) {
				java.io.File file = new java.io.File(physicalFilePath);
				return file.exists();
			}
		}

		return false;
	}

    /**
     * 獲取文件圖標名.
     * Date: 2005-10
     * @param application JSP/Servlet 的 ServletContext
     * @param iconDirPath 圖標文件夾的路徑
     * @param fileName 需要處理的文件名
     * @return 圖標文件相對路徑
     */
	public static String getFileIcon(ServletContext application,
			String iconDirPath, String fileName) {
		String ext = getExtension(fileName);
        String filePath = iconDirPath + ext + ".gif";
//        return filePath;

        if(checkFileExists(application, filePath)) {
            return filePath;
        }
		return iconDirPath + "file.gif";
	}

	/**
	 * 輸出分頁顯示的結果.
	 *
	 * @param page
	 *            當前頁面
	 * @param recordCount
	 *            所有結果
	 * @param pageSize
	 *            一頁顯示的多少
	 * @param pageCountSize
	 *            前后跳頁的多少
	 * @param linkpageurl
	 *            連接頁面的 URL 字符串
	 * @return 分頁結果的字符串.
	 */
	public static String paging(int page, int recordCount, int pageSize,
			int pageCountSize, String linkpageurl) {
		int PageCount = -1; //頁面總數
		String LinkPageName = linkpageurl;
		String LinkText = "";
		int StartPage;
		int TempPage;
		int TempPageCount;
		TempPage = (page - 1) % pageCountSize; //唱贛瘤 備竊
		StartPage = page - TempPage; //矯累 其撈瘤 備竊
		TempPageCount = recordCount % pageSize;
		if (TempPageCount == 0) {
			PageCount = recordCount / pageSize;
		} else {
			PageCount = (recordCount / pageSize) + 1; //傈眉 其撈瘤 薦
		}
		String txtPrev = " [前" + pageCountSize + "頁] ";
		String txtNext = " [后" + pageCountSize + "頁] ";
		String txtStart = " [首頁] ";
		String txtEnd = " [末頁] ";
		//貿瀾欄肺
		if (StartPage - 1 > 0) {
			LinkText += "<a href='" + LinkPageName + "&page=1' title='到此頁'>"
					+ txtStart + "</a>";
		} else {
			LinkText += txtStart;
		}
		//撈傈 10俺..
		if (StartPage - 1 > 0) {
			LinkText += "<a href='" + LinkPageName + "&page=" + (StartPage - 1)
					+ "' title='到第" + pageCountSize + "頁'>" + txtPrev + "</a>";
		} else {
			LinkText += txtPrev;
		}
		for (int i = StartPage; i < StartPage + pageCountSize; i++) {
			if (i < PageCount + 1) {
				LinkText += "<a href='" + LinkPageName + "&page=";
				LinkText += i + "' title='" + i + "頁'>";
				if (i == page) {
					LinkText += "<b>[" + i + "]</b>";
				} else {
					LinkText += "[" + i + "]";
				}
				LinkText += "</a>";
			}
		}
		//中間頁面
		if (StartPage + pageCountSize - PageCount - 1 < 0) {
			LinkText += "<a href='" + LinkPageName + "&page="
					+ (StartPage + pageCountSize) + "' title='到第"
					+ pageCountSize + "頁'>" + txtNext + "</a>";
		} else {
			LinkText += txtNext;
		}
		//最后一頁
		if (StartPage + pageCountSize <= PageCount) {
			LinkText += "<a href='" + LinkPageName + "&page=" + PageCount
					+ "' title='最后一頁'>" + txtEnd + "</a>";
		} else {
			LinkText += txtEnd;
		}
		return LinkText;
	}

	/**
	 * Gets the absolute pathname of the class or resource file containing the
	 * specified class or resource name, as prescribed by the current classpath.
	 *
	 * @param resourceName
	 *            Name of the class or resource name.
	 * @return the absolute pathname of the given resource
	 */
	public static String getPath(String resourceName) {

		if (!resourceName.startsWith("/")) {
			resourceName = "/" + resourceName;
		}

		//resourceName = resourceName.replace('.', '/');

		java.net.URL classUrl = new StringUtil().getClass().getResource(
				resourceName);

		if (classUrl != null) {
			//System.out.println("\nClass '" + className +
			//"' found in \n'" + classUrl.getFile() + "'");
			//System.out.println("\n資源 '" + resourceName +
			//"' 在文件 \n'" + classUrl.getFile() + "' 中找到.");

			return classUrl.getFile();
		}
		//System.out.println("\nClass '" + className +
		//"' not found in \n'" +
		//System.getProperty("java.class.path") + "'");
		//System.out.println("\n資源 '" + resourceName +
		//"' 沒有在類路徑 \n'" +
		//System.getProperty("java.class.path") + "' 中找到");
		return null;
	}

	/**
	 * 將日期轉換為中文表示方式的字符串(格式為 yyyy年MM月dd日 HH:mm:ss).
	 */
	public static String dateToChineseString(Date date) {
		if (date == null) {
			return "";
		}

		java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat(
				"yyyy年MM月dd日 HH:mm:ss");

		return dateFormat.format(date);
	}

	/**
	 * 將日期轉換為 14 位的字符串(格式為yyyyMMddHHmmss).
	 */
	public static String dateTo14String(Date date) {
		if (date == null) {
			return null;
		}

		java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat(
				"yyyyMMddHHmmss");

		return dateFormat.format(date);
	}

	/**
	 * 將 14 位的字符串(格式為yyyyMMddHHmmss)轉換為日期.
	 */
	public static Date string14ToDate(String input) {
		if (isEmpty(input)) {
			return null;
		}

		if (input.length() != 14) {
			return null;
		}

		java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat(
				"yyyyMMddHHmmss");

		try {
			return dateFormat.parse(input);
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		return null;
	}

	// -----------------------------------------------------------
	// ---------- 字符串和數字轉換工具方法, 2004.03.27 添加 --------
	//------------------------------------------------------------
	public static byte getByte(HttpServletRequest httpservletrequest, String s) {
		if (httpservletrequest.getParameter(s) == null
				|| httpservletrequest.getParameter(s).equals("")) {
			return 0;
		}
		return Byte.parseByte(httpservletrequest.getParameter(s));
	}

	/**
	 * Reading a parameter as integer from the http servlet request.
	 *
	 */
	public static int getInt(HttpServletRequest httpservletrequest, String s) {
		if (httpservletrequest.getParameter(s) == null
				|| httpservletrequest.getParameter(s).equals("")) {
			return 0;
		}
		return Integer.parseInt(httpservletrequest.getParameter(s));
	}

	public static long getLong(HttpServletRequest httpservletrequest, String s) {
		if (httpservletrequest.getParameter(s) == null
				|| httpservletrequest.getParameter(s).equals("")) {
			return 0L;
		}
		return Long.parseLong(httpservletrequest.getParameter(s));
	}

	public static short getShort(HttpServletRequest httpservletrequest, String s) {
		if (httpservletrequest.getParameter(s) == null
				|| httpservletrequest.getParameter(s).equals("")) {
			return 0;
		}
		return Short.parseShort(httpservletrequest.getParameter(s));
	}

	/**
	 * 將 TEXT 文本轉換為 HTML 代碼, 已便于網頁正確的顯示出來.
	 *
	 * @param input
	 *            輸入的文本字符串
	 * @return 轉換后的 HTML 代碼
	 */
	public static String textToHtml(String input) {
		if (isEmpty(input)) {
			return "";
		}

		input = replace(input, "<", "&#60;");
		input = replace(input, ">", "&#62;");

		input = replace(input, "\n", "<br>\n");
		input = replace(input, "\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
		input = replace(input, "  ", "&nbsp;&nbsp;");

		return input;
	}

	public static String toQuoteMark(String s) {
		s = replaceString(s, "'", "&#39;");
		s = replaceString(s, "\"", "&#34;");
		s = replaceString(s, "\r\n", "\n");
		return s;
	}

	public static String replaceChar(String s, char c, char c1) {
		if (s == null) {
			return "";
		}
		return s.replace(c, c1);
	}

	public static String replaceString(String s, String s1, String s2) {
		if (s == null || s1 == null || s2 == null) {
			return "";
		}
		return s.replaceAll(s1, s2);
	}

	public static String toHtml(String s) {
		s = replaceString(s, "<", "&#60;");
		s = replaceString(s, ">", "&#62;");
		return s;
	}

	public static String toBR(String s) {
		s = replaceString(s, "\n", "<br>\n");
		s = replaceString(s, "\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
		s = replaceString(s, "  ", "&nbsp;&nbsp;");
		return s;
	}

	public static String toSQL(String s) {
		s = replaceString(s, "\r\n", "\n");
		return s;
	}

	public static String replaceEnter(String s) throws NullPointerException {
		return s.replaceAll("\n", "<br>");
	}

	public static String replacebr(String s) throws NullPointerException {
		return s.replaceAll("<br>", "\n");
	}

	public static String replaceQuote(String s) throws NullPointerException {
		return s.replaceAll("'", "''");
	}

	// Test only.
	public static void main(String[] args) throws Exception {
		//System.out.println(textToHtml("1<2\r\n<b>Bold</b>"));
		//System.out.println(scriptAlert("oh!"));
		//System.out.println(scriptRedirect("http://localhost/"));
		//    System.out.println(StringUtil.getPath("/databaseconfig.properties"));
		//		java.io.File file = new java.io.File("e:\\Moblog\\abcd\\");
		//
		//		file.mkdir();
		Date time = (parseHMSStringToDate("12:23:00"));
		System.out.println(time.toLocaleString());
		Date nowTime = parseHMSStringToDate(formatDateToHMSString(new Date()));
		System.out.println(nowTime.toLocaleString());

		//		GregorianCalendar cal = new GregorianCalendar();
		//		cal.setTime(new Date());
		//		cal.add(cal.YEAR, -cal.get(cal.YEAR) + 1970);
		//		cal.add(cal.MONTH, -cal.get(cal.MONTH));
		//		cal.add(cal.DATE, -cal.get(cal.DATE) + 1);
		//
		//		System.out.println(cal.getTime().toLocaleString());
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美大尺度电影在线| 国产精品一区二区视频| 欧美丝袜丝nylons| 亚洲精品亚洲人成人网在线播放| 91香蕉视频污在线| 一区二区三区欧美亚洲| 欧美日韩久久一区| 日韩成人免费在线| xf在线a精品一区二区视频网站| 精品一区二区在线视频| 国产亚洲成av人在线观看导航| 国产麻豆精品久久一二三| 欧美国产精品一区| 色综合色综合色综合色综合色综合 | 欧美色电影在线| 亚洲成av人片| 亚洲精品一区二区三区福利| 高清日韩电视剧大全免费| 国产精品全国免费观看高清| 色屁屁一区二区| 蜜桃视频在线观看一区| 国产日韩亚洲欧美综合| 日本大香伊一区二区三区| 日本欧美久久久久免费播放网| xfplay精品久久| 91久久一区二区| 久久99国产精品免费网站| 一区二区中文视频| 欧美丰满少妇xxxbbb| 成人免费看的视频| 天天综合网天天综合色| 日本一区二区三区四区在线视频| 色综合久久久久综合| 六月丁香综合在线视频| 国产精品福利影院| 在线不卡中文字幕| 99久久婷婷国产综合精品电影| 亚洲v日本v欧美v久久精品| 久久久久国产成人精品亚洲午夜| 欧美亚洲精品一区| 国产福利一区在线| 肉丝袜脚交视频一区二区| 亚洲国产成人私人影院tom| 欧美日韩国产另类一区| 国产69精品久久99不卡| 男男视频亚洲欧美| 亚洲四区在线观看| 久久久精品人体av艺术| 欧美高清视频在线高清观看mv色露露十八| 国产高清亚洲一区| 日本午夜精品一区二区三区电影 | 蜜乳av一区二区三区| 亚洲天堂免费看| 久久嫩草精品久久久精品一| 欧美日韩一区中文字幕| 99re66热这里只有精品3直播| 蜜臂av日日欢夜夜爽一区| 亚洲成a人片在线观看中文| 国产精品久久久久久久久动漫 | 欧美日韩国产综合久久| 成人ar影院免费观看视频| 国模无码大尺度一区二区三区| 亚洲国产三级在线| 亚洲欧美另类在线| 国产欧美精品一区二区三区四区 | 久久久久久久免费视频了| 欧美剧情电影在线观看完整版免费励志电影 | 亚洲图片欧美一区| 成人免费在线播放视频| 中文字幕免费不卡在线| 精品久久人人做人人爽| 欧美一区二区三区免费观看视频| 色狠狠一区二区三区香蕉| 色悠悠亚洲一区二区| 成人黄色av电影| 成人国产精品免费观看视频| 国产福利不卡视频| 国产一区二区三区日韩| 精品一区二区三区影院在线午夜| 丝袜亚洲另类欧美| 日本特黄久久久高潮| 日本不卡一二三| 久久国产麻豆精品| 极品少妇xxxx偷拍精品少妇| 韩国精品免费视频| 国内久久婷婷综合| 国产成人三级在线观看| 高清视频一区二区| 99久久精品国产一区| 色哟哟精品一区| 欧美亚洲禁片免费| 欧美大片国产精品| 久久久久久夜精品精品免费| 国产日韩影视精品| 亚洲三级在线观看| 亚洲动漫第一页| 奇米888四色在线精品| 蜜桃精品视频在线| 丰满白嫩尤物一区二区| 91啦中文在线观看| 欧美美女直播网站| 精品国产乱子伦一区| 国产欧美视频一区二区| 亚洲人成网站影音先锋播放| 夜色激情一区二区| 蜜臀av国产精品久久久久| 国产精品亚洲一区二区三区在线| 成人精品国产免费网站| 欧美最猛黑人xxxxx猛交| 宅男在线国产精品| 国产亚洲精品bt天堂精选| 中文字幕亚洲不卡| 视频在线观看91| 国产一区视频导航| 91黄色激情网站| 26uuu久久天堂性欧美| 亚洲欧洲99久久| 日本不卡在线视频| 成人免费看黄yyy456| 宅男在线国产精品| 亚洲欧洲精品一区二区三区不卡| 亚洲成人久久影院| 国产一区二区免费在线| 色哟哟国产精品免费观看| 精品久久久久av影院 | 精品视频全国免费看| 久久综合久久综合亚洲| 亚洲一二三区在线观看| 国产米奇在线777精品观看| 欧美性一区二区| 久久久久久日产精品| 日本亚洲天堂网| av男人天堂一区| 精品sm捆绑视频| 亚洲成人免费视| 色综合天天综合狠狠| 欧美精品一区二区久久婷婷| 亚洲影院免费观看| 国产精品中文欧美| 欧美精品九九99久久| 中文字幕视频一区| 国产精品亚洲视频| 制服丝袜一区二区三区| 亚洲一区二区三区中文字幕| 国产99久久久国产精品潘金 | 欧美性色综合网| 中文无字幕一区二区三区| 久久se这里有精品| 欧美在线不卡一区| 国产精品乱码一区二三区小蝌蚪| 蜜乳av一区二区| 91精品国产91综合久久蜜臀| 亚洲狠狠丁香婷婷综合久久久| 国产高清亚洲一区| 久久综合九色综合欧美98| 久热成人在线视频| 666欧美在线视频| 亚洲免费在线视频| 成人h动漫精品一区二区| 久久久久国产精品麻豆| 国内精品伊人久久久久av一坑 | 欧美三级蜜桃2在线观看| 国产精品入口麻豆九色| 国产成人精品aa毛片| 久久人人爽人人爽| 国产99久久久国产精品| 国产亚洲欧美色| 国产白丝网站精品污在线入口| 久久夜色精品国产欧美乱极品| 激情文学综合插| 精品国产sm最大网站免费看| 韩国女主播一区二区三区| 久久综合五月天婷婷伊人| 国内精品写真在线观看| 2020国产精品久久精品美国| 韩国精品主播一区二区在线观看 | 日韩国产在线观看| 欧美一级片在线看| 久久国产精品72免费观看| 日韩一区二区三区四区| 精东粉嫩av免费一区二区三区| 日韩你懂的电影在线观看| 精品一区二区三区在线观看| 久久网这里都是精品| 高清不卡在线观看| 中文字幕在线不卡| 欧美最猛性xxxxx直播| 日韩精品亚洲专区| 欧美大尺度电影在线| 国产 欧美在线| 亚洲欧美激情小说另类| 欧美色中文字幕| 青青国产91久久久久久| 久久综合久久鬼色中文字| 国产91综合一区在线观看| 亚洲精品免费一二三区| 欧美精品粉嫩高潮一区二区| 国产一区二三区| 亚洲男人的天堂av| 欧美一区二区三区四区高清|