当前位置:首页 » 多媒体相关

文件操作的问题(jsp的)


[javac]   since   fork   is   true,   ignoring   compiler   setting.  
          [javac]   compiling   1   source   file  
          [javac]   since   fork   is   true,   ignoring   compiler   setting.  
          [javac]   f:\tomcat   4.1\work\standalone\localhost\examples\listfile_jsp.java:69:   illegal   start   of   expression  
          [javac]                        
          [javac]                       ^  
          [javac]   f:\tomcat   4.1\work\standalone\localhost\examples\listfile_jsp.java:50:   cannot   resolve   symbol  
          [javac]   symbol     :   class   listfile      
          [javac]   location:   class   org.apache.jsp.listfile_jsp  
          [javac]               listfile   file   =   null;  
          [javac]               ^  
          [javac]   f:\tomcat   4.1\work\standalone\localhost\examples\listfile_jsp.java:52:   cannot   resolve   symbol  
          [javac]   symbol     :   class   listfile      
          [javac]   location:   class   org.apache.jsp.listfile_jsp  
          [javac]                   file   =   (listfile)   pagecontext.getattribute("file",   pagecontext.page_scope);  
          [javac]                                   ^  
          [javac]   f:\tomcat   4.1\work\standalone\localhost\examples\listfile_jsp.java:55:   cannot   resolve   symbol  
          [javac]   symbol     :   class   listfile      
          [javac]   location:   class   org.apache.jsp.listfile_jsp  
          [javac]                           file   =   (listfile)   java.beans.beans.instantiate(this.getclass().getclassloader(),   "listfile");  
          [javac]                                           ^  
          [javac]   f:\tomcat   4.1\work\standalone\localhost\examples\listfile_jsp.java:71:   cannot   resolve   symbol  
          [javac]   symbol     :   variable   name      
          [javac]   location:   class   org.apache.jsp.listfile_jsp  
          [javac]                       for(int   i=0;i"+name[i]);  
          [javac]                                                                           ^  
          [javac]   6   errors  
   
  下面三个文件  
  import         java.io.*;  
  class     filename     implements     filenamefilter  
  {  
                      string     str-null;  
                     
                        filename(string     s)  
                        {  
                                        str="."+s;  
                        }  
                     
                        public     boolean       accept(file     dir,string   name)  
                        {  
                                          return   name.endswith(str);  
                        }  
  }  
   
   
  import       java.io.*;  
  public     class     listfile  
  {  
                  string   extendsname=null;  
                   
                  public     void     setextendsname(string   s)  
                  {  
                                  extendsname=s;  
                  }  
   
                    public     string     getextendsname()  
                    {  
                                  return     extendsname;  
                  }  
     
                  public     string[]   listfile()  
                  {  
                                file     dir=new     file("f:/tomcat   4.1/webapps/examples");  
                                filename     file_jsp=new       filename(extendsname);  
                                string     file_name[]=dir.list(file_jsp);  
                                return     file_name;  
                  }  
  }  
                         
  <%@   page     contenttype="text/html;   charset=gb2312"   %>  
  <%@   page     import="circle"   %>  
  <html>  
  <body>  
  <form   action=""   method="post">  
      <p>输入文件的扩展名:  
        <input   type=text   name="extendsname">  
        <input   type=submit   value="提交">  
        <jsp:usebean   id="file"   class="listfile"   scope="page"   >  
        </jsp:usebean>  
        <jsp:setproperty   name="file"   property="extendsname"   />  
          文件有:  
            <%    
                      <br>  
                      string     name[]=file.listfile();  
                      for(int   i=0;i<name.length;i++)  
                      {  
                                    out.println("<br>"+name[i]);  
                      }  
              %>  
  </body>  
  </html>  
   
  那有问题          
 

.

推荐阅读

  • 泰科:宣布推出超薄结构以太网磁性模块 [详细内容]
  • 今日美国:承销商评级无情 百度股价遭重创 [详细内容]
  • 坊间传言默多克曾计划以30亿美元收购Skype [详细内容]
  • Sun公司的门户软件将采用Aligo模块 [详细内容]
  • C930基本使用方法 [详细内容]
  • 微软李开复案开听证会 盖茨巴尔默视频作证 [详细内容]
  • 天瀚:宣布开发平板电脑笔式手写输入模块 [详细内容]
  • 网友回答:

    讨论区

    Login