一个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在线调查问卷系统"是一个集成了前后端技术的实用工具,适用于各类组织进行在线调查和数据收集,它的设计和实现充分展示了Java Web开发的技术魅力和实用性。
javabean一个简单的例子,可直接用
JavaBean是一种特殊的Java类,它遵循特定的规范,主要用于封装数据和业务逻辑,方便在Java应用程序或Web应用中重用。
一个jsp+javabean完整例子代码
JSP是用于构建动态Web应用程序的服务器端技术,而JavaBeans是一种组件模型,允许开发人员创建可重用的代码段。【描述】提到的“完整例子”旨在帮助初学者理解这两种技术的协同工作。
一个servlet,javabean。的例子
的例子"中,我们可以想象这样一个场景:一个Servlet接收到用户的登录请求,它首先解析请求参数,然后创建一个JavaBean实例,将用户名和密码设置到JavaBean中。
一个精典实用的jsp+javabean例子
【标题】:“一个精典实用的jsp+javabean例子”【描述】:“jsp javabean 例子 学习 自己用的例子”这个压缩包文件包含的是一个经典的JSP(JavaServer Pages)与JavaBean


Web 开发
