| | |
how to get to next record on click of a button
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
hi every1
i m new to website development.
just learning it.
i have made a code in which i access my database(MS Access).
i m able to print the first record of the database on the page.
but i m not able to go to next record which i want to show on click of a button.
i dont want to use while(rs.next) as i dont want to show all the records at once.
the code i m writing is->
i m new to website development.
just learning it.
i have made a code in which i access my database(MS Access).
i m able to print the first record of the database on the page.
but i m not able to go to next record which i want to show on click of a button.
i dont want to use while(rs.next) as i dont want to show all the records at once.
the code i m writing is->
JSP Syntax (Toggle Plain Text)
<%@ page import="java.sql.*" %> <htmL> <% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String dataSourceName="mydsn"; String dbURL="jdbc:odbc:" + dataSourceName; Connection con= DriverManager.getConnection(dbURL,"",""); Statement s=con.createStatement(); s.execute("select * from web"); ResultSet rs; rs=s.getResultSet() ; rs.next(); %> <body> <script> function getDetails() { rs.next() } </script> <form method="post"> Website:<input type="text" value="<%=rs.getString(1) %>"><br> <a rel="nofollow" class="t" href="http://www.daniweb.com/techtalkforums/<input" target="_blank">Url:<input</a> type="text" value="<%=rs.getString(2) %>"><br> Category: <input type="text" value="<%=rs.getString(3) %>"><br> Description: <input type="text" value="<%=rs.getString(4) %>"><br> Search Engine-><br> Yahoo: <input type="text" value="<%=rs.getString(5) %>"><br> Google: <input type="text" value="<%=rs.getString(6) %>"><br> Altavista: <input type="text" value="<%=rs.getString(7) %>"><br> <input type="button" value="Next" onClick="getDetails()"> </form> </body> </html>
Last edited by bhuvan83; Mar 13th, 2007 at 7:53 am.
Bhuvan Aggarwal
There is no word impossible.
its i m possible
There is no word impossible.
its i m possible
Why don't you store whole databse into bean and then on button press request next set
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
nice explanation on wikipedia
bellow is how do I get data from my db about events in calendar
Also do not connect to DB from JSP use servlets
bellow is how do I get data from my db about events in calendar
JSP Syntax (Toggle Plain Text)
CalendarData[] eArr = new CalendarData[exists]; try { int i=0; strQuery = "select event_type, ev_date, ev_time, ev_description from calendar_events where userName='" + strUser + "' and cal_id='" + calId + "'"; rs = stmt.executeQuery( strQuery); while( rs.next()) { eArr[i] = new CalendarData(); eArr[i].setEventType(rs.getString("event_type") ); eArr[i].setEventDate(rs.getString("ev_date") ); eArr[i].setEventTime(rs.getInt("ev_time") ); eArr[i].setEventDescription(rs.getString("ev_description") ); i++; } // end while loop session.setAttribute("eventArray", eArr); CalendarData[] test = (CalendarData[]) session.getAttribute("eventArray");
Also do not connect to DB from JSP use servlets
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- I want next record to Display (VB.NET)
- I want next record to Display (VB.NET)
- how to get to next record on click of a button. (JavaScript / DHTML / AJAX)
- how to move to the next record in MySQLdb? (Python)
- how do i get the current time when i click a button? (ASP)
Other Threads in the JSP Forum
- Previous Thread: Multiple Select List Handling
- Next Thread: How to Auto refresh a part of a page
| Thread Tools | Search this Thread |
Tag cloud for JSP
apache array backbutton combobox comma connection csv database development directorystructure dropdownlist dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 mysql netbeans network parameters passing ping printinserverinsteadofclient project read redirect request.getparameter response seperated servlet servletdopost()readxml sessions software sql ssl state_saving_method stocks sun tomcat tutorial update values video web write






