jsp中一个很奇怪的初级问题

Tom_ruanbb 2004-08-25 06:28:51
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 129 in the jsp file: /classmanage/admin/adminmark_add.jsp

Generated servlet error:
[javac] Compiling 1 source file

D:\Tomcat 5.0\work\Catalina\localhost\myproject\org\apache\jsp\classmanage\admin\adminmark_005fadd_jsp.java:176: ';' expected
out.write(">");
^
这个说明,javac还能找到,类也可以找到,但我将这个错误改正以后,反而出现以下错误:
message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

No Java compiler was found to compile the generated source for the JSP.
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.
If using an alternate Java compiler, please check its installation and access path.

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:128)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:413)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:285)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:232)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.
我已经配置了环境变量java_home,path,classpath,而且已经将tools.jar,dt.jar拷到tomcat 5.0/common/lib下了,而且tomcat服务器重起了还几次,也没什么改变,不知问题出在哪

...全文
106 点赞 收藏 8
写回复
8 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Tom_ruanbb 2004-08-26
<tr>
<td colspan="3" height="8" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td width="205" bgcolor="#FFFFFF" valign="top">
<%//call adminmenu()%>
</td>
<td width="1" background="images/dotlinev.gif"></td>
<td width="554" bgcolor="#FFFFFF" valign="top" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"><table width="98%" border="0" align="center" cellpadding="8" cellspacing="1" bgcolor="#C7C7C7">
<tr align="center" bgcolor="#E8E8E8">
<td width="50%" class="chinese"><a href="">课程管理</a></td>
<td width="50%" class="chinese"><a href="?action=newnews#newnews">课程管理</a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"></td>
</tr>
</table></td>
</tr>
</table>


<table width="98%" border="0" cellspacing="1" cellpadding="4" bgcolor="#293863">
<form name="CourseParam" method="post" action="admincourse.jsp">
<tr bgcolor="#999999">
<td colspan="2"><a name="newnews">课程选择参数</a></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFFF" class="chinese">学年:-
<select name="selyear">
<option value="2003-2004学年" selected>2003-2004学年</option>
<option value="2004-2005学年">2004-2005学年</option>
</select>
      </td>
<td width="50%" bgcolor="#FFFFFF" class="chinese">学期:-
<select name="selterm">
<option value="1" selected>第一学期</option>
<option value="2">第二学期</option>
</select></td>
</tr>
<tr>
<td height="30" colspan="2" align="center" bgcolor="#E8E8E8" class="chinese">
<input type="button" name="ViewCourse" value="参看课程" onClick="JavaScript:GoCourse(document.CourseParam.ViewCourse);">
<input type="button" name="AddCourse" value="添加课程" onClick="JavaScript:GoCourse(document.CourseParam.AddCourse);">
</td>
</tr>

</form>
</table>
<% if(request.getParameter("OperationFlag")!=null && request.getParameter("OperationFlag").equals("ViewCourse")){
%>
<br>
<table width="98%" border="0" cellspacing="1" cellpadding="4" bgcolor="#293863">
<tr bgcolor="#999999">
<td colspan="4" class="diaryhead style2">课程浏览</td>
</tr>
<tr bgcolor="#E8E8E8" align="center">
<td class="chinese" width="12%">课程编号</td>
<td width="34%" class="chinese">课程名</td>
<td width="34%" class="chinese">学分数</td>
<td class="chinese" width="20%">操作</td>
</tr>
<%
String SelYear=request.getParameter("CourseYear");
SelYear=SelYear.substring(0,4); //获取前4位
String SelTerm=request.getParameter("CourseTerm");

String semester =GetSemester(SelYear,SelTerm); //得到学期数



String StrSql="select distinct cno,cname,credit from VCourse where semester='"+semester+"'";

ResultSet RS = workM.executeQuery(StrSql);
while (RS.next()) {
%>
<tr>
<td bgcolor="#FFFFFF" class="chinese" align="center"><%=RS.getString("cno")%>
</td>
<td bgcolor="#FFFFFF" class="chinese"><%=RS.getString("cname")%>
</td>
<td bgcolor="#FFFFFF" class="chinese"><%=RS.getString("credit")%>
</td>
<td bgcolor="#FFFFFF" class="chinese"><div align="center"><a href="admincourse.jsp?cno=<%=RS.getString("cno")%>&OperationFlag=EditCourse#EditCourse">编辑</a>
<a href="admincourse.jsp?cno=<%=RS.getString("cno")%>&OperationFlag=CourseDel#CourseDel" >删除</a>
</div></td>
</tr>
<% } %>
<% RS.close(); %>
</table>
<% } //课程浏览结束
回复
Tom_ruanbb 2004-08-26
<%@ page language="java" import="java.sql.*" %>
<%@ page import="java.util.*" %>
<jsp:useBean id="workM" scope="page" class="mssql.faq" />

<link rel="stylesheet" href="site_css.css" type="text/css">
<style type="text/css">
<!--
.style2 {color: #000000}
-->
</style>



<script language="javascript">
function GoCourse(ObjName){

obj=document.CourseParam;
String CourseYear=obj.selyear.value;
String CourseTerm=obj.selterm.value;
CourseYear=CourseYear.substring(0,4);
if (ObjName.value.equals("添加课程"))
OperationFlag="AddCourse";
else
OperationFlag="ViewCourse";
window.location.href="admincourse.jsp?session_boolean=true&="+CourseYear+"&CourseTerm="+CourseTerm+"&OperationFlag="+OperationFlag;
}//CourseYear
</script>

<%! String GetSemester(String SelYear,String SelTerm){
int StartYear=2003;
//Integer IntYear=new Integer();
int DurationYear=Integer.parseInt(SelYear)-StartYear;
String semester;
switch(DurationYear){
case 0:
if (SelTerm.equals("1"))
semester="1";
else
semester="2";
break;
case 1:
if (SelTerm.equals("1"))
semester="3";
else
semester="4";
break;
case 2:
if (SelTerm.equals("1"))
semester="5";
else
semester="6";
}//switch
return semester;
}
%>

<%
if (request.getParameter("session_boolean")!=null){
session.setAttribute("scyear")=request.getParameter("CourseYear");
session.setAttribute("term")=request.getParameter("CourseTerm");
}

if (request.getParameter("OperationFlag")!=null &&request.getParameter("OperationFlag").equals("CourseUpdate")){
String Cno=request.getParameter("Cno");
String Cname=request.getParameter("Cname");
String StrCno=request.getParameter("Cno");
//Integer x=new Integer();
int Cno=Integer.parseInt(StrCno);
String StrUpdate="update TCourse set cno='"+Cno+"'";
workM.executeUpdate(StrUpdate);
}//
if(request.getParameter("OperationFlag")!=null && request.getParameter("OperationFlag").equals("DelCourse")){
String Cno=request.getParameter("cno");
String StrDel="Delete TCourse where cno='"+Cno+"'";
workM.executeUpdate(StrUpdate);
}//DelCourse

if(request.getParameter("OperationFlag")!=null && request.getParameter("OperationFlag").equals("CourseAdd")){
String Cno=request.getParameter("Cno");
String Cname=request.getParameter("Cname");
String Credit=request.getParameter("Credit");
String semester=GetSemester(session.getAttribute("scyear"),session.getAttribute("term"));
String StrInsert="insert into TCourse values('"+Cno+"','"+Cname+"','"+Credit+"','"+Semester+"')";
workM.executeUpdate(StrInsert);
}//addCourse

%>


<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
回复
Tom_ruanbb 2004-08-26
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>

</body>
</html>
我贴了以上代码,运行正常,这样是不是说明,配置没错
回复
shangqiao 2004-08-26
不可能是配置的错误,还是你的代码出问题了,写一个什么都不作的html代码作为jsp运行试试看会不会出错
回复
hoggio_1980 2004-08-26
你出错了吧,应该把Tomcat下common\lib中的jsp-api.jar 和servlet-api.jar拷贝到jdk的\jre\lib\ext下,并且要删除你先前的操作。另外把你的环境变量配置贴上来看看,你配置对没有?
回复
caiyi0903 2004-08-26
掉了个;号
回复
playboylee 2004-08-26
谁看得了那么多,,贴...代...码
回复
power17 2004-08-26
请贴源代码。
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2004-08-25 06:28
社区公告
暂无公告