1,“应该保存在哪里呢”
我刚做的一个项目,使用独立的properties文件保存配置信息;2,“另外对于那个DTD,我是否应该下载下来呢?”
不需要下载3,“还是干脆从xml文件中删除掉对dtd文件的“束缚”?”
您可别介
你这样改的话,你的ejb就不能通用了,并且不能通过很多应用服务器的检查

解决方案 »

  1.   

    问下楼上的,你的那个properies放在哪儿,怎么让EJB能找到它
    可不可以专用个EJB来管理这些配置?
      

  2.   

    to 空值异常,
    呵呵,不好意思,我的项目中没有用到EJB,所以,你需要自己验证一下下面的方法是否能够通过EJB来使用:1,将记录配置信息的river.properties文件放在WEB-INF/classes目录下;
    2,编写访问配置文件的RiverProperties.java文件:
    public class RiverProperties { private static final String BUNDLE_NAME = "river"; private static final ResourceBundle RESOURCE_BUNDLE =
    ResourceBundle.getBundle(BUNDLE_NAME); private RiverProperties() {
    } public static String getString(String key) throws RiverException,MissingResourceException{
    try {
    return RESOURCE_BUNDLE.getString(key);
    } catch (MissingResourceException e) {
    System.out.println(e.getMessage());
    }
    }
    }