主题:请教高手
//helloworld.java
package mybean.tosolve;
import java.io.*;
public class counter extends Object{
public String path="";
public String filePath=path;
public String CntStr="";
public String getCount() throws FileNotFoundException
{
BufferedReader file;
file=new BufferedReader(new FileReader(filePath));
try{
CntStr=file.readLine();
}catch(IOException e){
System.out.println("读取数据失败!");
}
return CntStr;
}
public void setCount() throws FileNotFoundException
{
try{
PrintWriter pw=new PrintWriter(new FileOutputStream(filePath));
pw.println(Integer.parseInt(CntStr)+1);
pw.close();
}catch(IOException e){
System.out.println(e.getMessage());
}
}
}
<!-- countertosolve.jsp -->
<%@ page contentType="text/html;charset=GBK" %>
<html>
<head>
<jsp:useBean id="counter" scope="request" class="mybean.tosolve.counter"/>
<%counter.path="c:/counter.txt";
String count=counter.getCount();
counter.setCount();
%>
<center>
<h2>计数器</h2>
您是本网页的第<font color="ff0000" size="7"><%=count%></font>名访客!
</center>
</html>
每次运行出错:
[color=800000]type Status report
message /myworks/bean/countertosolve.jsp
description The requested resource (/myworks/bean/countertosolve.jsp) is not available.[/color]
请问是为什么啊?环境变量应该没问题,我运行其他的程序没问题(使用了javabean 的)
谢谢啦
package mybean.tosolve;
import java.io.*;
public class counter extends Object{
public String path="";
public String filePath=path;
public String CntStr="";
public String getCount() throws FileNotFoundException
{
BufferedReader file;
file=new BufferedReader(new FileReader(filePath));
try{
CntStr=file.readLine();
}catch(IOException e){
System.out.println("读取数据失败!");
}
return CntStr;
}
public void setCount() throws FileNotFoundException
{
try{
PrintWriter pw=new PrintWriter(new FileOutputStream(filePath));
pw.println(Integer.parseInt(CntStr)+1);
pw.close();
}catch(IOException e){
System.out.println(e.getMessage());
}
}
}
<!-- countertosolve.jsp -->
<%@ page contentType="text/html;charset=GBK" %>
<html>
<head>
<jsp:useBean id="counter" scope="request" class="mybean.tosolve.counter"/>
<%counter.path="c:/counter.txt";
String count=counter.getCount();
counter.setCount();
%>
<center>
<h2>计数器</h2>
您是本网页的第<font color="ff0000" size="7"><%=count%></font>名访客!
</center>
</html>
每次运行出错:
[color=800000]type Status report
message /myworks/bean/countertosolve.jsp
description The requested resource (/myworks/bean/countertosolve.jsp) is not available.[/color]
请问是为什么啊?环境变量应该没问题,我运行其他的程序没问题(使用了javabean 的)
谢谢啦