<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import = "java.sql.*" %><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<% for(int i=0;i<10;++i)
{
out.print(i);
}
%> </body>
</html>这个可以运行 在Tomcat 下可以。但是 下面就不可以了。<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%><%@ page import = "java.sql.*" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
Date date = new Date();
out.print(d);
%>
</body>
</html>
为什么呢。
org.apache.jasper.JasperException: Unable to compile class for JSP:
为什么提示没有编译呢??
<%@ page import = "java.sql.*" %><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<% for(int i=0;i<10;++i)
{
out.print(i);
}
%> </body>
</html>这个可以运行 在Tomcat 下可以。但是 下面就不可以了。<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%><%@ page import = "java.sql.*" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
Date date = new Date();
out.print(d);
%>
</body>
</html>
为什么呢。
org.apache.jasper.JasperException: Unable to compile class for JSP:
为什么提示没有编译呢??
解决方案 »
- JMS回复错误
- swf单独放HTTP服务器上,后端的JAVA应用服务器上flex[services-config.xml]中如何设置endpoint?
- flash与web链接
- java.lang.NumberFormatException,仿BBS小程序出错,进来帮忙看看。。
- tomcat运行停止的原因?(急)
- 一个Struts数据源问题
- 多个客户端同时读取一个表 怎样做到一次读取数据提供给多个客户端
- out.write()空指针异常
- <在线等待>遇到这种错误怎么办?
- springboot 打包 jar 无法访问 webapp下的资源?
- 为什么地址栏会显示用户名,密码
- 能否推荐个struts1的网络教程网址??
<%
Date date = new Date();
out.print(d);
%>d是哪里来的,LZ看仔细了。
是
Date date = new Date();
out.print(date)
的 。。我导入了
<@ page import = "java.util.*" %>
就可以了。。
pageEncoding="ISO-8859-1"%> <%@ page import = "java.sql.*" %> //好像你没有用到数据库方面的吧<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here </title>
</head>
<body>
<%
Date date = new Date(); //没有写完整Date()的引用包
out.print(d); //这里应该是date吧?
%>
</body>
</html>
解决方法:
方法一:将<%@ page import = "java.sql.*" %>修改为:<%@ page import = "java.util.*" %>,后面不用修改.
方法二:将Date date = new Date(); 修改为:java.util.Date date = new java.util.Date();
<%
Date date = new Date();
out.print(d);
%>
基础问题啦!好好再看看
1,检查是否将classpath设置错误:正确的为.;%java_home%\lib\rt.jar;%java_home%\lib\tools.jar <!--java_home is your jdk directory-->
2,This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
看到了吗?
把jdk安装目录下的lib/tools.jar拷贝到tomcat安装目录下的common/lib目录下,然后重启tomcat,试试 。
1,检查是否将classpath设置错误:正确的为.;%java_home%\lib\rt.jar;%java_home%\lib\tools.jar <!--java_home is your jdk directory-->
2,This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
看到了吗?
把jdk安装目录下的lib/tools.jar拷贝到tomcat安装目录下的common/lib目录下,然后重启tomcat,试试 。