使用绝对路径
"/xxx"
/指你的项目的根目录,就是<Contex DocBase="xxx"...里面的路径
"/xxx"
/指你的项目的根目录,就是<Contex DocBase="xxx"...里面的路径
解决方案 »
- 请问大侠们jsp的标签能不能用js来输出,并且生效?
- File--- getRequest().getParameter转码问题,????????
- eWebEditor在线文本编辑器,使用中的问题
- 163相册上放在图片,能够单独打开该图片,但在其它论坛中引用该图片却显示不出,怎么办?
- java web打印文件的问题,谁有办法?望高手解答
- 超级中文难题,获取邮件服务器的主题后一部分是中文显示,另一部分是问号,请高手帮我解决。
- 关于HashMap,List的小问题(100分)
- 救救菜鸟,支持JSP程序员
- java.lang.NullPointerException这个异常是什么意思??
- HTTP发送报文问题 在线求解!!!!!!!!!!
- 救命,我上传图片到数据库中,如果图片大于10K的话,取出来就可以正常显示,少于10K就显示不出来,为什么啊????
- 谁能帮我看看这个问题,100分回报!org.apache.jasper.JasperException: Must specify type attribute if name is specified
import java.util.*;public class news
{
private String path;
private StringBuffer newstext = new StringBuffer();
public void setpath(String path)
{
this.path = path;
} public String getpath()
{
return path;
} public String gettext()
{
try
{
FileInputStream news = new FileInputStream(path);
byte buff1[] = new byte[99999];
int i= news.read(buff1);
if (i != -1)
{
newstext=new StringBuffer(new String(buff1));//注意这里 newstext=new StringBuffer("\"+new String(buff1));
}
news.close();
String text = new String(newstext);
return text;
}
catch (Exception e)
{
System.out.println(e);
}
return null;
}
}
+- myone
+- news
+- resources
+- mytest.properties
+- my.txtFile file = new File("my.txt");
File file2 = new File("./resources/mytest.properties");
System.out.print(file.getAbsolutePath());
这样无论是在window还是在linux上都OK.