ServletConfig config;
config.getInitParameter("Prefix");
这样子?
能否具体点?我试过好象不可以。

解决方案 »

  1.   

    不用
    直接调用getInitParameter("..");
    如public class BulletinBoard extends HttpServlet
    {
      private String filePath; //stores root path for bulletin files
      private Properties propTopics; //stores bulletin board topics
      /**
       * init() method is called when the servlet is first loaded. It
       * reads the directory where the bulletin files are stored from
       * an initialization parameter.
       */
      public void init() throws ServletException
      {
        FileInputStream fileTopics = null;
       
          //open input stream to topics.properties file
          //fileTopics = new FileInputStream("c:\\topics.properties");
        filePath=getInitParameter("FilePath");