1 你的getServletContext()是哪个类的,Servlet里没有2 ServletContext.etRealPath(): This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).
还是空的
This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).
Servlet里怎么可能没有呢,如果没有我的Servlet老早报警了
用ServletConfig接口听getServletContext()方法得到关于Servlet执行的servlet上下文的引用.大家可以查查..不是没有这个方法.
至于楼主的问题我解决不了...还没有接触到用此方法返回路径这方面的知识...
我有的是weblogic8.1好象不允许以目录形式发布
我的resin服务器的...\WEB-INF\classes文件夹下放了一个java文件,就是编译javabean的java文件,已经编译好了,我想,如果这个文件放在这个地方,很多时候服务器会自动编译它,当然在这个过程中会浪费很多时间,在程序连续执行的过程中,难免会对执行程序造成影响,所以会在随机的时间在随机的页面出现空指针问题,关键问题不在空指针,呵呵,我把java文件移走后,一切都是那样顺畅,爽啊。