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

📄 propmap.java

📁 This src code does or handles the login part .
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.wwr.login;import com.wwr.commons.ResourceManager;import java.util.HashMap;import java.util.Map;/** * * @author Administrator */public class PropMap {    Map<String, Object> map;    public Map<String, Object> getMap() {        try {                     //   Properties prop = new Properties();            String usernames = "";            String passwords = "";            //FileInputStream fin = new FileInputStream(f);          //  prop.load(new FileInputStream("D:\\NetBeansProjects\\cmsProperties.properties"));            usernames = ResourceManager.getString("UserNames");//prop.getProperty("UserNames");            passwords = ResourceManager.getString("Passwords");//prop.getProperty("Passwords");//            System.out.println(usernames);//            System.out.println(passwords);            String[] UnameArr = usernames.split(",");            String[] PassArr = passwords.split(",");             map = new HashMap<String, Object>();           // if (UnameArr.length != PassArr.length || usernames == null || passwords == null) {            //    System.out.println("Error in UserNames in the property file ");                for (int i = 0; i < UnameArr.length; i++) {                    //    System.out.println(UnameArr[i]+"###"+PassArr[i]);                        map.put(UnameArr[i], PassArr[i]);                    }              //  }//                System.out.println("Retrieving values from hashmap:");//                Iterator itr = map.entrySet().iterator();//                while (itr.hasNext()) {//                    System.out.println(itr.next());//                //              /// searching for a key in the map ...       //                  //                }//          //  } //                if(map.containsKey("wwr")){//                        System.out.println("keyfound ");//                        String val=(String)map.get("wwr");//                        System.out.println("the value for the key is  "+val+"");//                    }        } catch (Exception ex) {            ex.printStackTrace();        }         return map;    }            /*  public void getProp() {    map = new HashMap<String, Object>();    try {    URL url = (URL) getClass().getResource("\\ApplicationResource.properties");    System.out.print("in get Resource");    File f = null;    try {    System.out.println(url.toString());    f = new File(url.toURI());    } catch (URISyntaxException ex) {    ex.printStackTrace();    System.out.println("Error reading the Property File");    }    if (f.exists()) {    Properties prop = new Properties();    FileInputStream fin = new FileInputStream(f);    prop.load(fin);    usernames = prop.getProperty("UserNames");    passwords = prop.getProperty("Passwords");    System.out.print(usernames);    System.out.print(passwords);    }    } catch (Exception ex) {    ex.printStackTrace();    System.out.print("unable to find the resoucrce");    }    buildMap(usernames, passwords);       }     */    public void buildMap() {           }    public static void main(String args[]) {        new PropMap().getMap();    }}

⌨️ 快捷键说明

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