我还导入了它需要的文件,但即使如此,它还是给出了错误,这是完全正确的,我也导入了它的文件,但我是 jsp 新手,所以我没有收到错误.. 我的代码是
<%--
Document : host
Created on : Nov 25, 2011, 3:15:31 AM
Author : Administrator
--%>
<%@page import="Pages.Host"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.ResultSet" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Network Monitoring</title>
<link type="text/css" href="css/style.css" rel="stylesheet" media="all" />
</head>
<body style="background: whitesmoke" >
<%@page language="java" import="java.io.*" %>
<%@page language="java" import="java.util.*" %>
<% try
{
String strpath="/var/random.txt";
String line;
BufferReader objReader=new BufferReader(new FileReader(strpath));
line=objReader.readLine();
while(line !=null)
{
int num_from_file=0;
int my_random_num=0;
out.println(line);
num_from_file=(int)Interger.parseInt(line);
Random_generator=new Random(num_from_file);
my_random_num=generator.netInt();
line=objReader.readLine();
}
}
catch(IOException e){}
%>
</body>
</html>
希望得到您的建议......
提前致谢
最佳答案
您需要导入它
添加
<%@page import="java.io.BufferedReader"%>
然后纠正拼写:)
关于java - JSP 中出现错误 "Buffer reader can not be resolver to a type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8601871/