在我的jsp页面中我导入了类,它在我的电脑上运行文件在tomcat 7上,但是当我将它上传到我的服务器时,它给jsp文件编译错误我的代码
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page import="com.*" %>
<%@ page import="DIO.*" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
和我收到错误的地方是
<td class="value"><%= com.PageCounter.getIntTodaysCount() %></td>
我的类PageCounter在com包内,它在我的本地主机pc上运行文件 上传到服务器时错误
,错误是
An error occurred at line: 32 in the jsp file: /index.jsp
PageCounter cannot be resolved
29: <table cellspacing="0" class="info_table" style="height: 175px" >
30: <tbody>
31: <tr>
32: <td class="value"><%= PageCounter.getIntTodaysCount() %></td>
33: <td class="full">Visits Today</td>
34: </tr>
由于tomcat版本的改变,它将会发生
任何建议都会有很大的帮助
错误是
An error occurred at line: 51 in the jsp file: /index.jsp
DIO cannot be resolved to a type
48: <div class="portlet-header">
49: <h4>Upcoming Events</h4>
50: </div> <!-- .portlet-header -->
51: <% DIO sharedDataBase = (DIO)application.getAttribute("sharedDataBase");
52: String[][] eventData=sharedDataBase.getData("select eventName,eventDescription,eventDate from listOfEvents order by eventDate desc", 10);%>
53: <div class="portlet-content">
54: <marquee direction="up" onmouseover="stop()" style="height: 200px" onmouseout="start()" scrollamount="2"
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
页面计数器类
package com;
import java.util.Date;
import java.sql.SQLException;
import DIO.DIO;
public class PageCounter {
private static int count;
private static int todaysCount;
private static Date previousDate=new Date();
public static int getIntTodaysCount(){
Date date = new Date();
if (previousDate.before(date)) {
++todaysCount;
}else{
previousDate=date;
todaysCount=1;
}
return todaysCount;
}
public static int getIntCount(DIO sharedDataBase){
count++;
try {
sharedDataBase.updateData("update pageCount set pageCount="+count+" where pageCountId=1");
} catch (SQLException e) {
e.printStackTrace();
}
return count;
}
}