jsp出现File cannot be resolved to a type的问题
<%@pagelanguage="java"import="java.util.*"pageEncoding="GB2312"%><html><bodybgcolor="...
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<html>
<body bgcolor="#csd96">
<P>
<font Size=6 color=purple>
This is readFile.jsp
</font>
</P>
<FONT Size=4>
<%
String s= request.getParameter("file");
File f=new File(s);
if(f.exists())
{
out.println("<BR>文件"+s+"的内容:");
FileReader in=new FileReader(f);
BufferedReader br=new BufferedReader(in);
String line=null;
while((line=br.readLine())!=null)
{
out.println("<BR>"+line);
}
}
else
{
%>
<jsp:forward page="error.jsp">
<jsp:param name="mess" value="File Not Found"/>
</jsp:forward>
<%
}
%>
</FONT>
</body>
</html>
出现问题:
Description Resource Path Location Type
File cannot be resolved to a type readFile.jsp shiyan2(2)/WebRoot line 12 JSP Problem
File cannot be resolved to a type readFile.jsp shiyan2(2)/WebRoot line 12 JSP Problem
FileReader cannot be resolved to a type readFile.jsp shiyan2(2)/WebRoot line 16 JSP Problem
FileReader cannot be resolved to a type readFile.jsp shiyan2(2)/WebRoot line 16 JSP Problem 展开
<html>
<body bgcolor="#csd96">
<P>
<font Size=6 color=purple>
This is readFile.jsp
</font>
</P>
<FONT Size=4>
<%
String s= request.getParameter("file");
File f=new File(s);
if(f.exists())
{
out.println("<BR>文件"+s+"的内容:");
FileReader in=new FileReader(f);
BufferedReader br=new BufferedReader(in);
String line=null;
while((line=br.readLine())!=null)
{
out.println("<BR>"+line);
}
}
else
{
%>
<jsp:forward page="error.jsp">
<jsp:param name="mess" value="File Not Found"/>
</jsp:forward>
<%
}
%>
</FONT>
</body>
</html>
出现问题:
Description Resource Path Location Type
File cannot be resolved to a type readFile.jsp shiyan2(2)/WebRoot line 12 JSP Problem
File cannot be resolved to a type readFile.jsp shiyan2(2)/WebRoot line 12 JSP Problem
FileReader cannot be resolved to a type readFile.jsp shiyan2(2)/WebRoot line 16 JSP Problem
FileReader cannot be resolved to a type readFile.jsp shiyan2(2)/WebRoot line 16 JSP Problem 展开
2个回答
展开全部
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%@page import="java.io.FileReader"%>
<html>
<body bgcolor="#csd96">
<P>
<font Size=6 color=purple>
This is readFile.jsp
</font>
</P>
<FONT Size=4>
<%
String s= request.getParameter("file");
java.io.File f=new java.io.File(s);
if(f.exists())
{
out.println("<BR>文件"+s+"的内容:");
java.io.FileReader in=new java.io.FileReader(f);
java.io.BufferedReader br=new java.io.BufferedReader(in);
String line=null;
while((line=br.readLine())!=null)
{
out.println("<BR>"+line);
}
}
else
{
%>
<jsp:forward page="error.jsp">
<jsp:param name="mess" value="File Not Found"/>
</jsp:forward>
<%
}
%>
</FONT>
</body>
</html>
<%@page import="java.io.FileReader"%>
<html>
<body bgcolor="#csd96">
<P>
<font Size=6 color=purple>
This is readFile.jsp
</font>
</P>
<FONT Size=4>
<%
String s= request.getParameter("file");
java.io.File f=new java.io.File(s);
if(f.exists())
{
out.println("<BR>文件"+s+"的内容:");
java.io.FileReader in=new java.io.FileReader(f);
java.io.BufferedReader br=new java.io.BufferedReader(in);
String line=null;
while((line=br.readLine())!=null)
{
out.println("<BR>"+line);
}
}
else
{
%>
<jsp:forward page="error.jsp">
<jsp:param name="mess" value="File Not Found"/>
</jsp:forward>
<%
}
%>
</FONT>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询