此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【salana】截止到2008-07-16 20:13:19的历史汇总数据(不包括此帖):
发帖的总数量:13                       发帖的总分数:650                      每贴平均分数:50                       
回帖的总数量:19                       得分贴总数量:3                        回帖的得分率:15%                      
结贴的总数量:12                       结贴的总分数:550                      
无满意结贴数:0                        无满意结贴分:0                        
未结的帖子数:1                        未结的总分数:100                      
结贴的百分比:92.31 %               结分的百分比:84.62 %                  
无满意结贴率:0.00  %               无满意结分率:0.00  %                  
值得尊敬

解决方案 »

  1.   

    好歹用高亮代码功能格式化一下啊,看起来太乱了
    另外,类名的首字母要最好规范的大些!public class Readxml{}
      

  2.   

    public class readxml{ 
    public static String aa="sdafd"; 
    public static String index1=null; 
    public static String index2=null; 
    public static String index3=null; 
    public static String index4=null; 
    public static String index5=null; 
    public static String index6=null; 
        public readxml() { 
        
      
            Properties la = new Properties(); 
            try { 
                FileInputStream file = new FileInputStream("D:/workspace/modernserver/WebRoot/WEB-INF/classes/mail.properties"); 
                la.load(file); 
                String index01 = la.getProperty("index01"); 
                String index02 = la.getProperty("index02"); 
                String index03 = la.getProperty("index03"); 
                String index04 = la.getProperty("index04"); 
                String index05 = la.getProperty("index05"); 
                String index06 = la.getProperty("index06"); 
                
                this.index1=index01; 
                this.index2=index02; 
                this.index3=index03; 
                this.index4=index04; 
                this.index5=index05; 
                this.index6=index06; 
            } catch (Exception ex) {System.out.println(ex);         } 
            
        } 
    }就是我这个类在生成对象的时候index1会不会被附值?
      

  3.   

    你的index1、index2等属性定义都是static,当然不能用this引用了,将static修饰符去掉
      

  4.   

    会啊 构造函数里面只要不抛出异常 就会用资源文件里的值赋给 index 你运行有异常了吗
      

  5.   

    this.index1=index01; // 这里你不是赋值了么?String index01 = la.getProperty("index01"); // 当然,还要看你从文件mail.properties取到值没有
      

  6.   

    lz异常了^0^,忘记了他没import 
      

  7.   

    如何获得la对象中的所有的键例如:index1 和所有的值,能获得la对象所有元素的个数吗?
    可以通过索引的方式获得其中的值吗? la.getProperty(0); 
      

  8.   

    java基础不牢固,你这样学习servlet是事倍功半!
      

  9.   

    1 你的代码能编译吗? 
      我猜能,否则你不会来问了2 你的数据能拿到吗?
      我猜不能,肯定是null,否则也不来问了3 你的代码报异常了吗?
      1)报了
      } catch (Exception ex) {
        System.out.println(ex); 
      } 
      那就把你的异常信息贴上来  2) 没有,那就把你的 properties 文件贴上来
      

  10.   

    贴出來,否则怎么看,就这么点破问题,惊动了这么多CSDNer,奇怪
      

  11.   

    mail.properties文件内容如下[email protected]
    [email protected]  
    [email protected]
    [email protected]
    [email protected]
    [email protected]
      

  12.   

    lz看来好补习下java基础了,基础才是硬道理 ^0^
    可以结贴了。