一个JAVABEAN的例子程序出问题。(在线)
counter.java
----------------
import java.io.*;
public class counter extends Object {
private String currentRecord =null;
private String path =null;
private BufferedReader file;
public String ReadFile(String filePath) throws FileNotFoundException
{
path = filePath;
file = new BufferedReader(new FileReader(path)) ;
String returnStr=null;
try
{
currentRecord = file.readLine();
}
catch(IOException e)
{
System.out.println(e+"读取数据错误");
}
if (currentRecord==null)
currentRecord="没有记录";
else
{
returnStr=currentRecord;
}
return returnStr;
}
public void WriteFile(String filePath,String counter) throws FileNotFoundException
{
path = filePath;
int Writerstr =Integer.parseInt(counter)+1;
try
{
//?????
//PrintWriter pw = new PrintWriter(new FileOutputStream(filePath));
PrintWriter pw = new PrintWriter(new FileOutputStream(path));
pw.println(Writerstr);
pw.close();
}
catch(IOException e)
{
System.out.println(e+"写入文件错误");
}
}
}
在DOS下可以编译通过。但执行时JSP页面是出现问题。
我就哪到JBUILDER 6中却连编译也通不过
----------------
import java.io.*;
public class counter extends Object {
private String currentRecord =null;
private String path =null;
private BufferedReader file;
public String ReadFile(String filePath) throws FileNotFoundException
{
path = filePath;
file = new BufferedReader(new FileReader(path)) ;
String returnStr=null;
try
{
currentRecord = file.readLine();
}
catch(IOException e)
{
System.out.println(e+"读取数据错误");
}
if (currentRecord==null)
currentRecord="没有记录";
else
{
returnStr=currentRecord;
}
return returnStr;
}
public void WriteFile(String filePath,String counter) throws FileNotFoundException
{
path = filePath;
int Writerstr =Integer.parseInt(counter)+1;
try
{
//?????
//PrintWriter pw = new PrintWriter(new FileOutputStream(filePath));
PrintWriter pw = new PrintWriter(new FileOutputStream(path));
pw.println(Writerstr);
pw.close();
}
catch(IOException e)
{
System.out.println(e+"写入文件错误");
}
}
}
在DOS下可以编译通过。但执行时JSP页面是出现问题。
我就哪到JBUILDER 6中却连编译也通不过
...全文
相关推荐
jsp+javaBean+mysql在线调查问卷系统
jsp+javabean+mysql在线调查问卷,包括后台管理维护,灵活配置,问卷增删改查,发布,撤销,预览,终止评议等功能,支持饼图查看结果。mysql数据库,直接可以跑起来。
javabean一个简单的例子,可直接用
javabean的简单例子。可直接用。myeclipse的
一个jsp+javabean完整例子代码
自己写的一个完整例子,给大家分享.希望对刚学jsp和javabean的朋友有用
一个servlet,javabean。的例子
一个servlet,javabean。的例子一个servlet,javabean。的例子
一个精典实用的jsp+javabean例子
jsp javabean 例子 学习 自己用的例子


Web 开发

