aspose file tools*
The moose likes JDBC and the fly likes JSP Pagination not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JSP Pagination not working" Watch "JSP Pagination not working" New topic
Author

JSP Pagination not working

Kailash karayat
Greenhorn

Joined: Jun 22, 2012
Posts: 10
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

Joined: Jan 10, 2002
Posts: 61648
    
  67

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kailash karayat
Greenhorn

Joined: Jun 22, 2012
Posts: 10
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

Joined: Jan 10, 2002
Posts: 61648
    
  67

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

Joined: Jun 22, 2012
Posts: 10
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

Joined: Jun 22, 2012
Posts: 10
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

Joined: Jun 22, 2005
Posts: 86
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;
 
 
subject: JSP Pagination not working