⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 passwordbuilder.java

📁 servlet与jsp核心编程 书籍源码 部分
💻 JAVA
字号:
import java.util.*;
import java.io.*;

/** Application that writes a simple Java properties file
 *  containing usernames and associated passwords.
 *  <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 PasswordBuilder {
  public static void main(String[] args) throws Exception {
    Properties passwords = new Properties();
    passwords.put("marty", "martypw");
    passwords.put("bj", "bjpw");
    passwords.put("lindsay", "lindsaypw");
    passwords.put("nathan", "nathanpw");
    // This location should *not* be Web-accessible.
    String passwordFile =
      "C:\\JavaWebServer2.0\\data\\passwords.properties";
    FileOutputStream out = new FileOutputStream(passwordFile);
    // Using JDK 1.1 for portability among all servlet
    // engines. In JDK 1.2, use "store" instead of "save"
    // to avoid deprecation warnings.
    passwords.save(out, "Passwords");
  }
}

⌨️ 快捷键说明

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