使用dao程模仿老师那个分页功能,为啥网页显示500,后台报错,怎么解决?

来源:5-7 应用分页插件实现页面(下)

MrReign

2017-09-12 17:11

 Servlet.service() for servlet [JdbcSqlServlet] in context with path [/pager] threw exception

java.lang.RuntimeException: 查询所有数据异常

at com.cxl.page.service.impl.JdbcSqLStudentImpl.findStudent(JdbcSqLStudentImpl.java:77)

at com.cxl.page.service.impl.JdbcSqlStudentServiceImpl.findStudent(JdbcSqlStudentServiceImpl.java:20)

at com.cxl.page.servlet.JdbcSqlServlet.doPost(JdbcSqlServlet.java:66)

at com.cxl.page.servlet.JdbcSqlServlet.doGet(JdbcSqlServlet.java:26)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Unknown Source)

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '5' at line 1

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

at com.mysql.jdbc.Util.getInstance(Util.java:386)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2794)

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)

at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2322)

at com.cxl.page.util.JdbcUtil.findResult(JdbcUtil.java:128)

at com.cxl.page.service.impl.JdbcSqLStudentImpl.findStudent(JdbcSqLStudentImpl.java:61)

... 27 more

抛出这些异常,该怎么解决,有知道的帮助解决下,老师的原代码有地方下载么,照着对了好几遍没找到错误点。

http://img.mukewang.com/59b7a4b000019c0312560403.jpg

http://img.mukewang.com/59b7a4b00001778712740272.jpg


写回答 关注

2回答

  • 慕婉清7086058
    2017-12-10 09:49:50

    数据库有打开吗

  • MySecurity
    2017-10-14 17:32:02

    at com.cxl.page.service.impl.JdbcSqLStudentImpl.findStudent(JdbcSqLStudentImpl.java:77)

    at com.cxl.page.service.impl.JdbcSqlStudentServiceImpl.findStudent(JdbcSqlStudentServiceImpl.java:20)

    at com.cxl.page.servlet.JdbcSqlServlet.doPost(JdbcSqlServlet.java:66)

    at com.cxl.page.servlet.JdbcSqlServlet.doGet(JdbcSqlServlet.java:26)

    看你这些类中是否有转化不对的地方.

Java 分页原理与实践(上)

通过总结常见的分页样式,手把手带你实现java常见的分页功能

65018 学习 · 147 问题

查看课程

相似问题