• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Pagination not working

 
Kailash karayat
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have the following code for 1 questions per page in the examination system.

i have the following classes

1. Exam Class where i have the getters and setters for the class.
here is the code for the class



2nd is the ExamDAO class where the data pulling from the database is done.

here is the code for ExamDAO



then i have created a servlet and from the servlet i have forwarded the request to a jsp page

here is the code for servlet





and finally is the jsp page, where expression language is used for getting data.

here is the jsp page code.



i have also created a connectionpool which i am using in every class for creating the connection.

here is the connection pool class



now all this code is not giving any output and apart from this i have one more confusion of how to save the user input in database.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things:

Please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information. Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.

I've gone ahead and added the code tags for you. See how much easier the code is to read?

Secondly, posting all the code you've ever written isn't likely to get you responses from those best able to help you. ShowSomeEffort! Try to lock down where you think the problem is occurring. Have you checked to see at what point the servlet gets to? Whether the JSP is ever invoked? Do you really think showing us the connection pool is relevant?
 
Kailash karayat
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have gone through your post and from next time i will follow the same but for now the code is not working, i have checked the servlet, while executing the servlet it is giving error, please help to resolve this.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's how not to get help: post a lot of code without telling us what you've already done to debug it, what's working and what's not, and the exact text of errors that you are getting.

Do you not think that showing us the error message that you are getting would be somewhat helpful?
 
Kailash karayat
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i am really thankful for your quick responses, i have checked the code twice the first problem is with the database connection, now i am using the database connection statement there in the ExamDOA class and now it is giving this error:

<Error>

SQL Exception
java.sql.SQLException: ORA-00936: missing expression

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:790)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1038)
at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:830)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1133)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1273)
at ExamDOA.viewAllQuestions(ExamDOA.java:36)
at ExamServlet.doGet(ExamServlet.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

</error>

i have checked ExamDOA line 36 and the ExamServlet line 27, but exactly not getting what the error is.
 
Kailash karayat
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kailash karayat wrote:Hi,

i am really thankful for your quick responses, i have checked the code twice the first problem is with the database connection, now i am using the database connection statement there in the ExamDOA class and now it is giving this error:

<Error>

SQL Exception
java.sql.SQLException: ORA-00936: missing expression

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:790)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1038)
at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:830)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1133)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1273)
at ExamDOA.viewAllQuestions(ExamDOA.java:36)
at ExamServlet.doGet(ExamServlet.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

</error>

i have checked ExamDOA line 36 and the ExamServlet line 27, but exactly not getting what the error is.
 
Wei Dai
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String query = "select SQL_CALC_FOUND_ROWS * from EXAMINATION "
+ offset + ", " + noOfRecords;

You should use LIMIT
String query = "select SQL_CALC_FOUND_ROWS * from EXAMINATION LIMIT"
+ offset + ", " + noOfRecords;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic