非常简单的代码......不起作用,我不知道为什么:)
String appserver="";
HashMap hm = new HashMap();
hm.put("APPSERVER101", "node101");
hm.put("APPSERVER103", "node102");
hm.put("APPSERVER105", "node103");
hm.put("APPSERVER107", "node104");
hm.put("APPSERVER201", "node108");
hm.put("APPSERVER203", "node110");
...
appserver = rs_g.getString("APPSERVER");
...
out.println("<tr><td class=\"good\">" + hm.get(appserver) + "</td>");
结果为NULL,但如果我手动设置它:
out.println("<tr><td class=\"good\">" + hm.get("APPSERVER101") + "</td>");
我得到了正确的结果