jsp,javascript

jsp,javascript

View Answers

May 28, 2009 at 11:08 AM

Hi Friend,

Try the following code.It will retrieve previous and next record from the database to the table.

<%@ page import="java.sql.*" %>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ; %>

<HTML>
<FORM NAME="form1" METHOD="POST">
<%
int current = 0;
if(request.getParameter("hidden") != null) {
current = Integer.parseInt(request.getParameter("hidden"));
}

Connection connection = DriverManager.getConnection("jdbc:odbc:access", "", "");

Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs =
statement.executeQuery("select * from departments");

if(current < 1){
current = 1;
}

rs.last();
int rows = rs.getRow();
if(current <= rows){
rs.absolute(current);
}
%>

<TABLE BORDER="1">
<TR>
<TH>Department Number</TH>
<TH>Department Name</TH>
</TR>
<TR>
<TD><INPUT TYPE ="text" name = "dept" value="<%= rs.getString("dept_Name") %>"/></TD>
<TD><INPUT TYPE ="text" name = "number" value="<%= rs.getString("dept_No") %>"/> </TD>

</TR>
</TABLE>
<BR>
<INPUT TYPE="HIDDEN" NAME="hidden" VALUE="<%= current %>">
<INPUT TYPE="BUTTON" VALUE="Previous Record" ONCLICK="movePrevious()">
<INPUT TYPE="BUTTON" VALUE="Next Record" ONCLICK="moveNext()">
</FORM>

<SCRIPT LANGUAGE="JavaScript">
<!--
function moveNext()
{
var counter = 0
counter = parseInt(document.form1.hidden.value) + 1
document.form1.hidden.value = counter
form1.submit()
}
function movePrevious()
{
var counter = 0
counter = parseInt(document.form1.hidden.value) - 1
document.form1.hidden.value = counter
form1.submit()
}
</SCRIPT>
</HTML>

Thanks









Related Tutorials/Questions & Answers:
how to generate automatic bill based on selected values using jsp/javascript?
how to generate automatic bill based on selected values using jsp/javascript?  how to generate automatic bill based on selected values using jsp/javascript
jsp /javascript
jsp /javascript  Hii.. I have to design one registration page in java that looks like REGISTER USERNAME (here i have to check whether username already exists in database) EMAIL ADDRESS (here i have to check
Advertisements
jsp /javascript
jsp /javascript  Hii.. I have to design one registration page in java that looks like REGISTER USERNAME (here i have to check whether username already exists in database) EMAIL ADDRESS (here i have to check
How to get sub category based on category from database using jsp and javascript.
How to get sub category based on category from database using jsp and javascript.  How to get sub category based on category from database using jsp and javascript
How to make addition of two combobox values using jsp and javascript?
addition of two combobox values using jsp and javascript  How to make addition of two combobox values using jsp and javascript?  <html> <h2>ComboBox</h2> <script language="javascript"> var arr
jsp,javascript - JSP-Servlet
jsp,javascript   Hi, I want to retrieve record and move it. Can any body tell me what is the problem with this code Deparment function update(s) { alert(s); if (s==0) { alert("pr
jsp or javascript - Java Beginners
jsp or javascript  hello sir can i run sql query in javascript
rtf_jsp_javascript
rtf_jsp_javascript  Hi every one plz give me answer for below question ASAP I created one JSP(used pre defined javascript in jsp to get rtf format in browser) which creats RTF Format in browser to enter data. MY question
Servlets,Jsp,Javascript - JSP-Servlet
Servlets,Jsp,Javascript  Hi in my application i am creating a file... ExportToExcel button, jsp Upload plot nos (.xls format). GO Reset ExportToExcel javascript function excelExport() { document.body.style.cursor="wait
Pass value from JSP to JavaScript
Pass value from JSP to JavaScript       We can also pass the value from a JSP page to the java... script from the HTML page. Since in JSP page we can embed HTML tags as well. 
JSP Value to JavaScript
JSP Value to JavaScript          JSP Value to JavaScript tells you to pass the value from JSP to JavaScript. The JavaScript create a function
question
question  how to list images from a file and how to display that images as four different images in each row using jsp / javascript
question
question  i used the following code to disable browser back page javascript:window.history.forward(1); but not worked .please give the correct code to disable back page using jsp or javascript
jsp
jsp  Hi One Help... I want to develop like that using jsp/javascript but nothing is striking in mind... Please give some suggestions to design first Thanks in advance---- Vanchinathan.R
inbox structure
inbox structure  I want to create an inbox for my project in which records are to be fetched dynamically. I am using netbeans (jsp + javascript+ servlet.) The structure is same like yahoo inbox (1st column full of check boxes
Command Prompt in UI
Command Prompt in UI  Hi One Help... Please go through. I want to develop like that using jsp/javascript but nothing is striking in mind... Please give some suggestions to design first Thanks in advance---- Vanchinathan.R
include a jsp file
include a jsp file   Sir, I have 2 jsp pages. I want to include second jsp in the first jsp page when a button in the first jsp is clicked. how can I do this. I tried in sevaral ways . I am using jsp and javascript... anyone
jsp drop down without refresh - JSP-Servlet
refresh and what change's is made in jsp of javascript to make proper data...jsp drop down without refresh  Sir I have tried two depenedent jsp dropdown in jsp page,But the probleam is when i select first drop down its
rE - Java Beginners
rE  Hi Friends, use jsp and javascript technologies Add new row created dynamically is successfully..if user fill first row and save this form is successfully but user click add new row button then one row created
how to get data using dropdownlist, textbox and search button in jsp
how to get data using dropdownlist, textbox and search button in jsp  Hi, I want to display data using jsp,javascript and mysql. My Q. is If i select an entry suppose 'title' from dropdownlist and give a title name 'partial dif
plese send information how to do this - Development process
plese send information how to do this  present i am doing project on javaServlets,jsp,javascript plese see this i have created like subject: button:ok textfield mail: textarea footer
JSP - Update displayed content & session variables when user clicks on a button - JSP-Servlet
combination of JSP and javascript would work since my knowledge base is in Java. Here...JSP - Update displayed content & session variables when user clicks... JSP to do some internal check and then increment the value of a number
Java Pass Value Example
;  Pass value from JSP to JavaScript We can also pass the value from a JSP page to the java script as we have done in our... in JSP page we can embed HTML tags as well.    Pass
JSP Window. Open
JSP Window. Open          JSP Window. Open  is used to open a new window in JSP. The JavaScript function  window.open( ) open a new browser
Javascript - JDBC
and javascript I want to write the event handling code in another jsp page .so... want to use javascript in JSP page so that when click() event will generate...Javascript   Hi, I am doing a project in healthcare domain
dynamic drop down
into the designation drop down (use jsp+javascript+servlet) reply soon   1...; <script language="javascript" type="text/javascript">

Ads