首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

新学生,老异常!

2013-09-11 
新学生,老错误!!急!代码:%@pagecontentType text/htmlcharsetgb2312 language java import jav

新学生,老错误!!急!
代码:
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   import= "java.sql.*,java.util.* "   errorPage= " "   %>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
</head>

<body>
<%!   String   yewu,shijian,dishi,day_zeng,day_jian,day_jingzeng,zaiwang;%>
<%!   Connection   conn;%>
<%!   ResultSet   rs;%>
<%
yewu=request.getParameter( "yewu ").trim();
shijian=request.getParameter( "shijian ").trim();
dishi=request.getParameter( "dishi ").trim();
dishi=new   String(dishi.getBytes( "ISO-8859-1 "));
day_zeng=request.getParameter( "day_zeng ").trim();
day_jian=request.getParameter( "day_jian ").trim();
day_jingzeng=request.getParameter( "day_jingzeng ").trim();
zaiwang=request.getParameter( "zaiwang ").trim();

try
{
Class.forName( "oracle.jdbc.driver.OracleDriver ").newInstance();
String   url= "jdbc:oracle:thin:@localhost:1521:sd ";
String   user= "wyf ";
String   password= "wyf ";
Connection   conn=   DriverManager.getConnection(url,user,password);
Statement   stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String   sql= "insert   into   yewu(yewu,shijian,dishi,day_zeng,day_jian,day_jingzeng,zaiwang) ";
sql=sql+ "values( ' "+yewu+ " ', ' "+shijian+ " ', ' "+dishi+ " ', ' "+day_zeng+ " ', ' "+day_jian+ " ', ' "+day_jingzeng+ " ', ' "+zaiwang+ " ') ";
stmt.executeQuery(sql);
rs.close();
stmt.close();
conn.close();
}
catch(Exception   e){
response.sendRedirect( "err.jsp ");
}
%>
</body>
</html>
错误代码:
HTTP   Status   500   -  

--------------------------------------------

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

Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens


org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root   cause  

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

Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)


org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:413)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.5.16   logs.


--------------------------------------------

Apache   Tomcat/5.5.16

[解决办法]
import= "java.sql.*,

上面的逗号 , 有问题吧
[解决办法]
%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.*,java.util.* " errorPage= " " %>
这里没问题的
[解决办法]
Syntax error on tokens, delete these tokens

这句说明是你多写了什么标记符号
[解决办法]
代码好像没有什么问题,是不是下面的代码没有初始化啊
<%! Connection conn=null;%>
<%! ResultSet rs=null;%>
还有就是上面所说的那个,的问题
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html

热点排行