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

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

?? servletutilities.java

?? bbs頁面聊天系統
?? JAVA
字號:
package sjservlets;

/** A Servlet that contain various usefull small functions
 *  which will use by other servlet or/and JSP files
 *  <P>
 *  &copy; 2002 Song Jing; may be freely used or adapted.
 */
 
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.util.Date;
import java.text.DateFormat;
import java.util.Locale;

/** Some simple time savers. Note that most are static methods.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class ServletUtilities {
  public static final String DOCTYPE =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
    "Transitional//EN\">";

  public static String headWithTitle(String title) {
    return(DOCTYPE + "\n" +
           "<HTML>\n" +
           "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n");
  }

  /** Read a parameter with the specified name, convert it
   *  to an int, and return it. Return the designated default
   *  value if the parameter doesn't exist or if it is an
   *  illegal integer format.
  */
  
  public static int getIntParameter(HttpServletRequest request,
                                    String paramName,
                                    int defaultValue) {
    String paramString = request.getParameter(paramName);
    int paramValue;
    try {
      paramValue = Integer.parseInt(paramString);
    } catch(NumberFormatException nfe) { // null or bad format
      paramValue = defaultValue;
    }
    return(paramValue);
  }

  /** Given an array of Cookies, a name, and a default value,
   *  this method tries to find the value of the cookie with
   *  the given name. If there is no cookie matching the name
   *  in the array, then the default value is returned instead.
   */
  
  public static String getCookieValue(Cookie[] cookies,
                                      String cookieName,
                                      String defaultValue) {
    if (cookies != null) {
      for(int i=0; i<cookies.length; i++) {
        Cookie cookie = cookies[i];
        if (cookieName.equals(cookie.getName()))
          return(cookie.getValue());
      }
    }
    return(defaultValue);
  }

  /** Given an array of cookies and a name, this method tries
   *  to find and return the cookie from the array that has
   *  the given name. If there is no cookie matching the name
   *  in the array, null is returned.
   */
  
  public static Cookie getCookie(Cookie[] cookies,
                                 String cookieName) {
    if (cookies != null) {
      for(int i=0; i<cookies.length; i++) {
        Cookie cookie = cookies[i];
        if (cookieName.equals(cookie.getName()))
          return(cookie);
      }
    }
    return(null);
  }

  /** Given a string, this method replaces all occurrences of
   *  '<' with '&lt;', all occurrences of '>' with
   *  '&gt;', and (to handle cases that occur inside attribute
   *  values), all occurrences of double quotes with
   *  '&quot;' and all occurrences of '&' with '&amp;'.
   *  Without such filtering, an arbitrary string
   *  could not safely be inserted in a Web page.
   */

  public static String filter(String input) {
    StringBuffer filtered = new StringBuffer(input.length());
    char c;
    for(int i=0; i<input.length(); i++) {
      c = input.charAt(i);
      if (c == '<') {
        filtered.append("&lt;");
      } else if (c == '>') {
        filtered.append("&gt;");
      } else if (c == '"') {
        filtered.append("&quot;");
      } else if (c == '&') {
        filtered.append("&amp;");
      } else {
        filtered.append(c);
      }
    }
    return(filtered.toString());
  }
  
  // Builds a cascading style sheet with information
  // on three levels of headings and overall
  // foreground and background cover. Also tells
  // Internet Explorer to change color of mailto link
  // when mouse moves over it.
  
  public static String makeStyleSheet(String headingFont,
                                int heading1Size,
                                String bodyFont,
                                int bodySize,
                                String fgColor,
                                String bgColor) {
    int heading2Size = heading1Size*7/10;
    int heading3Size = heading1Size*6/10;
    String styleSheet =
      "<STYLE TYPE=\"text/css\">\n" +
      "<!--\n" +
      ".HEADING1 { font-size: " + heading1Size + "px;\n" +
      "            font-weight: bold;\n" +
      "            font-family: " + headingFont +
                     "Arial, Helvetica, sans-serif;\n" +
      "}\n" +
      ".HEADING2 { font-size: " + heading2Size + "px;\n" +
      "            font-weight: bold;\n" +
      "            font-family: " + headingFont +
                     "Arial, Helvetica, sans-serif;\n" +
      "}\n" +
      ".HEADING3 { font-size: " + heading3Size + "px;\n" +
      "            font-weight: bold;\n" +
      "            font-family: " + headingFont +
                     "Arial, Helvetica, sans-serif;\n" +
      "}\n" +
      "BODY { color: " + fgColor + ";\n" +
      "       background-color: " + bgColor + ";\n" +
      "       font-size: " + bodySize + "px;\n" +
      "       font-family: " + bodyFont +
                    "Times New Roman, Times, serif;\n" +
      "}\n" +
      "A:hover { color: red; }\n" +
      "-->\n" +
      "</STYLE>";
    return(styleSheet);
  }
  
  // Replaces null strings (no such parameter name) or
  // empty strings (e.g., if textfield was blank) with
  // the replacement. Returns the original string otherwise.
  
  public static String replaceIfMissing(String orig,
                                  String replacement) {
    if ((orig == null) || (orig.length() == 0)) {
      return(replacement);
    } else {
      return(orig);
    }
  }

  // Replaces null strings, empty strings, or the string
  // "default" with the replacement.
  // Returns the original string otherwise.
  
  public static String replaceIfMissingOrDefault(String orig,
                                           String replacement) {
    if ((orig == null) ||
        (orig.length() == 0) ||
        (orig.equals("default"))) {
      return(replacement);
    } else {
      return(orig + ", ");
    }
  }

  // Takes a string representing an integer and returns it
  // as an int. Returns a default if the string is null
  // or in an illegal format.
    
  public static int getSize(String sizeString, int defaultSize) {
    try {
      return(Integer.parseInt(sizeString));
    } catch(NumberFormatException nfe) {
      return(defaultSize);
    }
  }

  // Given "Java,C++,Lisp", "Java C++ Lisp" or
  // "Java, C++, Lisp", returns
  // "<UL>
  //   <LI>Java
  //   <LI>C++
  //   <LI>Lisp
  //  </UL>"

  public static String makeList(String listItems) {
    StringTokenizer tokenizer =
      new StringTokenizer(listItems, ", ");
    String list = "<UL>\n";
    while(tokenizer.hasMoreTokens()) {
      list = list + "  <LI>" + tokenizer.nextToken() + "\n";
    }
    list = list + "</UL>";
    return(list);
  }  
  
  public static Date stringToDate(String myDateStr) {
 	int inputYear = Integer.parseInt(myDateStr.substring(0,4)) - 1900;
	int inputMonth =  Integer.parseInt(myDateStr.substring(5,7)) - 1;
	int inputDate = Integer.parseInt(myDateStr.substring(8,10));	
  	return (new Date(inputYear, inputMonth, inputDate));
  }
  
  public static String dateToString(Date myDate) {  	
	int outputYear = myDate.getYear();
	int outputMonth = myDate.getMonth();
	int outputDate = myDate.getDate();
  	return ((outputYear+1900) +"-" +(outputMonth+1) +"-" +(outputDate));
  }
  
  public static Date diffrenceDay(Date myDate, int difDay){
  	int myYear = myDate.getYear();
	int myMonth = myDate.getMonth();
	int myDay = myDate.getDate();
  	return(new Date(myYear, myMonth, myDay + difDay));
  }
  
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
三级一区在线视频先锋| 91亚洲午夜精品久久久久久| 国产宾馆实践打屁股91| 老司机免费视频一区二区三区| 国产精品456露脸| 一本大道av一区二区在线播放| 欧美性xxxxxxxx| 69精品人人人人| 中文字幕巨乱亚洲| 亚洲成av人片一区二区三区| 国产综合色在线| 色婷婷av久久久久久久| 欧美影片第一页| 久久久精品免费免费| 亚洲精品乱码久久久久久久久 | 亚洲成人自拍偷拍| 国产福利一区二区三区在线视频| 99久久久免费精品国产一区二区| 欧美一区二区三区在线观看视频| 中文字幕国产一区| 免费在线一区观看| 色综合久久综合| 久久久精品国产免费观看同学| 亚洲国产综合色| 成人av电影在线| www国产精品av| 一区二区三区视频在线看| 国产精品2024| 精品人在线二区三区| 一区二区三区色| 99久久久无码国产精品| 久久老女人爱爱| 美女国产一区二区三区| 欧美视频一区在线| 中文字幕在线播放不卡一区| 精品一区二区日韩| 日韩视频一区二区在线观看| 亚洲一区二区在线免费观看视频| 国产成人在线视频网址| 欧美一卡2卡三卡4卡5免费| 亚洲精品国产a| 91免费观看国产| 精品久久久久久综合日本欧美| 日韩精品欧美精品| 欧美日韩高清影院| 亚洲一二三专区| 在线观看不卡视频| 樱桃视频在线观看一区| 成人教育av在线| 久久久久国产免费免费| 国产一区二区三区四区五区美女| 欧美成人性福生活免费看| 日本不卡高清视频| 精品视频全国免费看| 亚洲精品乱码久久久久久日本蜜臀| 99视频一区二区| 成人欧美一区二区三区在线播放| 麻豆精品一区二区三区| 日韩欧美中文一区| 精彩视频一区二区| 欧美电影免费观看完整版| 蜜桃精品视频在线| 精品国精品国产| 久久99精品久久久久久| 久久亚洲综合色一区二区三区| 国产一区二区按摩在线观看| 欧美激情一区二区三区全黄| 午夜不卡在线视频| 欧美成人精精品一区二区频| 国产露脸91国语对白| 中文乱码免费一区二区| 国产99精品视频| 亚洲色图一区二区三区| 欧美专区亚洲专区| 国产在线不卡视频| 亚洲va韩国va欧美va| 欧美国产日韩在线观看| 欧美日韩国产中文| 99精品1区2区| 国产麻豆欧美日韩一区| 亚洲国产日韩a在线播放性色| 中文字幕二三区不卡| 日韩欧美一级二级三级| 欧美色图一区二区三区| 国产成人午夜视频| 日韩av一区二区在线影视| 中文字幕一区在线| 久久亚洲二区三区| 91麻豆精品国产自产在线| 91视频观看免费| 国产xxx精品视频大全| 蜜臀91精品一区二区三区| 亚洲综合免费观看高清完整版在线| 国产日韩精品一区二区三区| 日韩欧美在线综合网| 欧美日韩一区不卡| 色哟哟一区二区在线观看| 国产精品一区二区无线| 九九九久久久精品| 秋霞国产午夜精品免费视频| 一区二区三区在线不卡| 综合色中文字幕| 国产精品无圣光一区二区| 久久亚洲精华国产精华液 | 日本免费新一区视频| 亚洲国产精品一区二区久久| 亚洲精选免费视频| 中文字幕一区二区三区蜜月 | 日韩黄色免费网站| 亚洲成人www| 亚洲电影在线免费观看| 亚洲最大色网站| 亚洲一区二区3| 午夜欧美在线一二页| 亚洲午夜精品网| 午夜影视日本亚洲欧洲精品| 午夜欧美视频在线观看| 日韩av电影天堂| 麻豆91在线播放免费| 精品亚洲欧美一区| 国产一区二区网址| 国产成人免费av在线| 成人动漫一区二区| 99久久免费视频.com| 欧美性做爰猛烈叫床潮| 777午夜精品视频在线播放| 91精品国产综合久久久久久久| 欧美一级一级性生活免费录像| 日韩欧美在线网站| 精品999久久久| 国产亚洲女人久久久久毛片| 日本一区二区免费在线| 亚洲精品午夜久久久| 亚洲成人1区2区| 寂寞少妇一区二区三区| 成人一区二区三区| 91视频精品在这里| 欧美久久久久免费| 国产亚洲成av人在线观看导航| 国产精品系列在线| 午夜精品在线视频一区| 狠狠色丁香久久婷婷综| 97久久精品人人澡人人爽| 欧美熟乱第一页| 精品少妇一区二区三区视频免付费 | 日本欧美一区二区在线观看| 激情欧美一区二区| 亚洲激情综合网| 免费高清不卡av| www.色综合.com| 在线电影院国产精品| 精品乱人伦一区二区三区| 久久久精品天堂| 亚洲国产视频直播| 国产精品88888| 欧美女孩性生活视频| 久久男人中文字幕资源站| 亚洲卡通欧美制服中文| 久久99精品久久久久婷婷| 91麻豆文化传媒在线观看| 欧美一二三区精品| 亚洲精品视频免费看| 美女一区二区三区| 99re热视频这里只精品| 精品国产乱码久久久久久1区2区| 中文字幕一区二区三区精华液 | 狠狠色丁香婷婷综合久久片| 成人看片黄a免费看在线| 欧美精品九九99久久| 亚洲欧洲在线观看av| 极品少妇一区二区三区精品视频| 色播五月激情综合网| 久久先锋资源网| 六月丁香婷婷色狠狠久久| 色域天天综合网| 国产精品视频一二| 精品亚洲aⅴ乱码一区二区三区| 欧美视频中文字幕| 亚洲精品乱码久久久久久| 成人精品一区二区三区四区| 精品剧情在线观看| 奇米亚洲午夜久久精品| 欧美性三三影院| 亚洲四区在线观看| 成人精品视频.| 国产三级欧美三级| 国内精品在线播放| 日韩免费电影一区| 日本va欧美va欧美va精品| 欧美日韩精品欧美日韩精品一| 亚洲欧美视频一区| 91一区二区三区在线观看| 中文字幕精品三区| youjizz国产精品| 亚洲国产精品成人综合| 国产福利91精品| 欧美国产日韩在线观看| 99麻豆久久久国产精品免费| 国产精品乱人伦| 92精品国产成人观看免费|