String s_filePath = "";
String s_path="";
s_filePath = request.getRealPath("/template/") + "template.html";
out.print(s_filePath);
String templateContent = "";
FileInputStream fileinputstream = new FileInputStream(s_filePath);// 读取模块文件 int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
templateContent = new String(bytes);
........................
........................省略部分
return s_path;大家帮我看看,这段代码哪儿有问题哦?
s_filePath 变量获取到文件的全路径,然后作为参数,传递给FileInputStream fileinputstream = new FileInputStream(s_filePath);中
但是,我通过断点跟踪发现,程序,走到FileInputStream fileinputstream = new FileInputStream(s_filePath);的地方,再往下走的时候,直接跳到
return s_path;位置,这显然不符合我的初综呀,我希望能读取这个摸板的文件的,但事实上,根本没有读取这摸板的内容,请求帮助
String s_path="";
s_filePath = request.getRealPath("/template/") + "template.html";
out.print(s_filePath);
String templateContent = "";
FileInputStream fileinputstream = new FileInputStream(s_filePath);// 读取模块文件 int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
templateContent = new String(bytes);
........................
........................省略部分
return s_path;大家帮我看看,这段代码哪儿有问题哦?
s_filePath 变量获取到文件的全路径,然后作为参数,传递给FileInputStream fileinputstream = new FileInputStream(s_filePath);中
但是,我通过断点跟踪发现,程序,走到FileInputStream fileinputstream = new FileInputStream(s_filePath);的地方,再往下走的时候,直接跳到
return s_path;位置,这显然不符合我的初综呀,我希望能读取这个摸板的文件的,但事实上,根本没有读取这摸板的内容,请求帮助
解决方案 »
- linux下安装jdk的问题
- 关于DatabaseMetaData的getColumns()方法参数问题,请高人帮帮忙
- 大家都用过hibernate吧,请教从网上看到某公司面试题,HIBERNATE在没有WEB的环境下如何解决中文乱码问题,指存入数据库时。
- 用JAVA实现FTP的时候如何在服务器上创建或删除一个目录?
- 给我一些常用的字符处理函数
- java的跨平台是怎么回事呢?能不能用编绎原理中的概念解释一下呢?
- 为什么HttpClient请求返回400,URL请求返回302正常?
- 在网络通讯程序中什么情况下选用TCP协议,什么情况下选用UDP协议?
- 为什么同一包下的类不能访问??在线等
- 请问jdk里面的classpath在哪里设置?
- 接口里的方法能重载吗?
- 导出的xml文件怎么保存到客户端
s_filePath = request.getRealPath("/template/") + "template.html";
这个路径有问题,经过修改,已经成功了