ÎÒµÄ sysconf.xml Îļþ·ÅÔÚSRC Ŀ¼ÏµÄ
ÎÒÔÚÀàÀïÃæ»ñÈ¡µÄ·¾¶
public class Colligate {
// ÅäÖÃÎļþ¾ßÌå·¾¶
public static String CONFIGXMLFILE = "\\WEB-INF\\classes\\sysconf.xml";
}
ÎÒÔÚÁíÍâÒ»¸öÀàÀïÃæ½âÎöÕâ¸öxmlÎļþ
public SysConf() {
readConfig();
}
public void readConfig() {
SAXBuilder sb = new SAXBuilder();
try {
Document doc = sb.build(new FileInputStream(Colligate.CONFIGXMLFILE));
È»ºóÎÒÔÚactionÀïÃæ String key = new SysConf().getKey(); ÕâÑù×Ó»ñÈ¡keyµÄÖµ£¬
½á¹û¾Í±¨´í
java.io.FileNotFoundException: \WEB-INF\classes\sysconf.xml(ϵͳÕÒ²»µ½Ö¸¶¨µÄÎļþ¡£)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream. <init>(FileInputStream.java:106)
at java.io.FileInputStream. <init>(FileInputStream.java:66)
at com.sshTest.common.SysConf.readConfig(SysConf.java:104)
at com.sshTest.common.SysConf. <init>(SysConf.java:24)
ÊÔÁ˺ܶà·¾¶£¬½á¹û»¹ÊDz»ÐС£ÕâÊÇΪʲô°¡£¡£¡£¡
public static String CONFIGXMLFILE = "WEB-INF/classes/sysconf.xml";
ÏÈÈ·¶¨ÊdzÌÐòÖ´Ðе½¾ßÌåÄÇÒ»ÐоÍÍ£Ö¹
δ±ØÊÇ·¾¶ÎÊÌâ
Ö±½Ósysconf.xml¾Í¿ÉÒÔ¡£
WebRoot/WEB-INF/hell.xml
»òÕß
WebRoot/WEB-INF/classes/hell.xml
ÄãµÄsysconf.xmlÊÇÔÚÏîÄ¿ÖеÄλÖÃsrc»¹ÊÇWEB-INFÖÐ
ÇóÖú¸÷λ´óϺ£¬Ñ§Éú³É¼¨µ¥XML SchemaµÄÉè¼Æ,XMLÎĵµµÄÉè¼Æ£¬°üº¬µÄÖ÷ÒªÐÅÏ¢£ºÑ§ºÅ¡¢Ñ§ÉúÐÕÃû¡¢Ïµ²¿¡¢°à¼¶¡¢¿¼ÊÔÈÕÆÚ¡¢ÈονÌʦ¡¢Ñ§·Ö¡¢Ñ§Ê±¡¢ÐÞϰÀà±ð¡¢Java³ÌÐòÉè¼Æ³É¼¨,ÍøÂç»ù´¡ÖªÊ¶³É¼¨¡¢ÍøÒ³ÖÆ×÷³É¼¨¡¢Èí¼þ¹¤³Ì³ ......