jspでカウンターを書きたい。これは私のコードです:
Countinghilfe.java:
package Counting;
import java.io.*;
import java.util.*;
public class Countinghilfe{
public static int getCount(){
String s="";
try {
BufferedReader in = new BufferedReader(new FileReader("Anzahl.txt"));
s=in.readLine();
} catch (IOException e) {
e.printStackTrace();
}
Integer zahl=new Integer(s);
return zahl;
}
public static void increase(){
String s="";
try {
BufferedReader in = new BufferedReader(new FileReader("Anzahl.txt"));
s=in.readLine();
Integer zahl=new Integer(s);
zahl++;
BufferedWriter output=new BufferedWriter(new FileWriter("Anzahl.txt"));
output.write(String.valueOf(zahl));
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
そして、counter.jsp ファイルで:
<html>
<head>
<title>Counter</title>
</head>
<body>
<%@ page import="Counting.Countinghilfe" %>
<%
Countinghilfe cl = new Countinghilfe();
out.println("<h2>Sie sind der ");
out.println( cl.getCount());
out.println(". Besucher auf unserer Site!</h2>");
cl.increase();
%>
</body>
</html>
表示されるエラー: org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP. そしてこれら:
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 生成された Java ファイルの 6 型のみインポートできます。Counting.Countinghilfe はパッケージに解決されます
Countinghilfe は型に解決できません
これを解決するにはどうすればよいですか?