Jsp and ajax
Hi
I am using jsp and ajax.I am retrieving the entire content from database(al.jsp) and
put it into a textbox.When i am clicking a combo box,it updates the selected value in the database(jag.jsp).
But it only works for first textbox and combobox.I noticed that it requires different id for textbox and combobox.
But i am not able to assign unique id.
Here is my code. Plz anybody help me.Its urgent.
al.jsp
<%@ page import="java.sql.*" %>
<%@ page import="javax.swing.*" %>
<%! Connection c;
Statement s;
ResultSet rs;
String cid,roll;
int i=0;
int j=1;
%>
<% try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c=DriverManager.getConnection("jdbc:odbc:comdsn1");
s=c.createStatement();
rs=s.executeQuery("select * from comt1");
}
catch(Exception e)
{} %>
<html>
<script>
function ajax(str){
var xmlHttp;
var i;
var config=document.getElementById('comboBoxMenu').value;
var config1=document.getElementById('t1').value;
var tids=document.getElementById('comboBoxMenu').getAttribute('id');
alert("coboid:"+tids);
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlHttp=new XMLHttpRequest();
}
catch(e){
alert("your browser cant support");
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4 && xmlhttp.status==200){
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
document.write(xmlHttp.responseText);
}
}
var url="jag.jsp";
url=url+"?q="+config+"&q1="+config1;
xmlHttp.open("POST",url,true);
xmlHttp.send(url);
}
</script>
<body>
<form method="post" name="jag">
<center><table>
<%
try
{
rs=s.executeQuery("select * from comt1");
while(rs.next())
{
roll=rs.getString("rollno");
i=i+1;
j=j+1;
%>
<tr><td><input type="text" value="<%=roll%>" name="t1" id="${i}" readonly></td><td>
<select name="comboBoxMenu" id="${j}" onchange="ajax(this.value);">
<option value="present">present</option>
<option value="absent">absent</option>
</select>
</td>
<td></tr>
<% }
}
catch(Exception e){}
%>
</table>
</center>
</form>
<div id="myDiv">
</div>
</body>
</html>
jag.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@ page import="java.sql.*" %>
<%@ page import="javax.swing.*" %>
<% String s1=request.getParameter("q");
String s2=request.getParameter("q1");
%>
<%try{
Connection c;
Statement st;
ResultSet rs;
JOptionPane.showMessageDialog(null,"welcome");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c=DriverManager.getConnection("jdbc:odbc:comdsn1");
st=c.createStatement();
rs=st.executeQuery("select * from comt1");
JOptionPane.showMessageDialog(null,"welcome updated"+s2+s1);
st.executeUpdate("update comt1 set [9-10]='"+s1+"' where rollno='"+s2+"'");
rs=st.executeQuery("select * from comt1");
JOptionPane.showMessageDialog(null,"updated");
}
catch(Exception ex){
out.println(ex);
}
%>
Thanks in advance.Anybody help me.its urgent plz.
View Answers
Related Tutorials/Questions & Answers:
jsp and ajaxjsp and ajax how to enable or disable textbox using radio buttons by using
jsp and
ajax jsp & ajaxjsp & ajax how to enable or disable textbox using radio buttons by using
jsp and
ajax?
plz help me.... i m new in
jsp &
ajax Advertisements
Ajax with jsp - AjaxAjax with jsp multiple combo boxes with
ajax in
jsp? Hi friend,
I am sending you a link. I hope that, this link will help you.
Please visit for more information.
http://www.roseindia.net/
jsp ajax jsp - Ajaxajax jsp multiple combo with
ajax using
jsp? Hi friend,
I am sending you a link. This link will help you. Please visit for more information.
http://www.roseindia.net/
jsp/comboSelect.shtml
Thanks
using jsp's....and ajax - Ajaxusing
jsp's....and ajax Hi,
i need code using
ajax .....in a text box when i enter an alphabet i should get list of words starts with the alphabet given in the text box
jsp - Ajaxjsp I'm very new in using the
jsp and
ajax,
i have some
JSP pages and i need to add some
ajax features in my
jsp
page,
for the example i need....
How can I implement this and then add this to my
jsp page?
please
ajax code with jsp - Ajaxajax code with jsp hi ,
Sorry for insufficient data.i m making some correction on question.
I have to perform some calculation on my
jsp page.
i want to do it automatically (using
ajax in
jsp).
problem is -
i hv two
ajax and jsp code - Ajaxajax and
jsp code can u please give me the code for retriving the data from database using
ajax
our requriment is
if i select country name in listbox display the corresponding all the states.
using
jsp and
ajax Jsp and ajaxJsp and ajax Hi
I am using
jsp and ajax.I am retrieving...;
function
ajax(str){
var xmlHttp;
var i;
var config=document.getElementById...";
url=url+"?
q="+config+"&q1="+config1;
xmlHttp.open("POST",url,true
Jsp and ajaxJsp and ajax Hi
I am using
jsp and ajax.I am retrieving...;
function
ajax(str){
var xmlHttp;
var i;
var config=document.getElementById...";
url=url+"?
q="+config+"&q1="+config1;
xmlHttp.open("POST",url,true
Jsp and ajaxJsp and ajax Hi
I am using
jsp and ajax.I am retrieving...;
function
ajax(str){
var xmlHttp;
var i;
var config=document.getElementById...";
url=url+"?
q="+config+"&q1="+config1;
xmlHttp.open("POST",url,true
Jsp and ajaxJsp and ajax Hi
I am using
jsp and ajax.I am retrieving...;
function
ajax(str){
var xmlHttp;
var i;
var config=document.getElementById...";
url=url+"?
q="+config+"&q1="+config1;
xmlHttp.open("POST",url,true
JSP and AJAX very urgent - AjaxJSP and
AJAX very urgent Hi Team,
This is Ragavendran.R.. I have a very basic doubt in
AJAX. While Using
AJAX, of course, there will be tag involved in
JSP page. But in my current project, I am using too many
tags
jsp and ajax - JSP-Servletjsp and ajax i had some problem
i want to display the current... to be automatically updated for every second
for that i want to make an
ajax call.../
jsp/fileupload.shtml
Thanks
ajax in jspajax in jsp i m not able to compare string with the responseText value, though the value in the responsetext is of string type.
my code:
login.jsp
<html>
<head>
<meta http-equiv
ajax in jspajax in jsp i m not able to compare string with the responseText value, though the value in the responsetext is of string type.
login.jsp:
print("<html>
<head>
<meta http-equiv="Content-Type" content="text
How to use ajax in jsp?How to use
ajax in
jsp? Hi,
How i can access the server-side data in
JSP using the
Ajax?
Thanks
Hi,
You can use the
Ajax code to access the server side data from
JSP page.
Check the tutorial Combo Box Using
Ajax JSP and AJAX- very urgent - AjaxJSP and
AJAX- very urgent Respected Sir/Madam,
I am... (Using
AJAX. for ur reference, I have included the coding below:
Login.html... not support
AJAX!");
return;
}
var url="check.jsp";
url=url+"?id="+alpha
jsp+ajax validationjsp+
ajax validation hi,
I have created the
jsp form (course... 60% in the drop down list .how to validate student from using
ajax and
jsp... have created student
jsp form where it should display register number
code for jsp - Ajax country.By using
jsp and
Ajax.
Hello Friend
I send the code you...code for jsp please give code for using
jsp page and Ajax.Retrive... getDetail(source,div){
getData(source,div);
}
An
Ajax Demo
Ajac code with jsp - AjaxAjac code with jsp hi ,
i am beginner for ajax.I have to perform some calculation on my
jsp page.
i want to do it automatically that is possible using
ajax.
problem is -
i hv two text box.
1st take
ajax in java - JSP-Servletajax in java The below code is for a php page but I want this in
JSP page.
function postRequest(strURL){
var xmlHttp...:
"login.php"
Hi friend,
Do some changes to convert in
JSP ajax code for jspajax code for jsp How to write
ajax code to retrieve information on to particular part of webpage when we select option from drop down box
The AJAX JSP Tag Library
The
AJAX JSP Tag Library
The
AJAX JSP Tag Library is a set of
JSP tags that
simplify the use of Asynchronous JavaScript and XML (
AJAX) technology in
JavaServer Pages. This tag
Ajax validation - JSP-ServletAjax validation How to fade out the images when an onblur function is called moving from a text box to another??
can anyone help out with with the code
refresh jsp page - Ajaxrefresh
jsp page Code for refresh a web page in
jsp. Hi friend,
function refreshpage()
{
window.location.reload
Selection With Ajax and JSPSelection With
Ajax and JSP I am working at a
jsp page using
ajax for country , state, city selection.
so if he select country it will populate... the city.
I am doing it through two
jsp pages only.
Country1.jsp :
<%@ page
Ajax - JSP-ServletAjax Simple
ajax code for getting one text box value Hi friend,
Code to help in solving the problem :
function postRequest... on
Ajax visit to :
http://www.roseindia.net/
ajax/
Thanks
datagid with paging using jsp - Ajaxdatagid with paging using jsp datagrid with paging using
ajax and jsp Hi friend,
For read more information :
http://www.roseindia.net/
jsp/data-grid.shtml
Thanks
Ajax using jspAjax using jsp <%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import...);
}
%>
Is there Any error...........In first Page I use
ajax for displaying
ajax using jspajax using jsp <%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.StringTokenizer" %>
<%@ page import="java.lang.*" %>
<
Ajax not working in jspAjax not working in jsp I'm using Netbean,
Ajax validation in the following code is not working the code succesfully run for first UID validation...; frmMain.elements[i].valid;
}
}
return blnValid;
}
//if
Ajax DropDown and text boxes with AJAX, JSP - Ajax present.
we are already using
jsp's and java technology. can we integrate
ajax in
jsp's to achieve the same? if so could you please guide me to achive the same...DropDown and text boxes with
AJAX, JSP Hi,
we are using one drop
DropDown in ajax+jspDropDown in
ajax+jsp I have four dropdown if i select first dd then only corresponding values must be there in 2nd dd,same with 3 and 4 and onchangfe it would not refresh the whole page.
Hi Friend,
Try the following
JQuery-JSP AJAX example not workingJQuery-
JSP AJAX example not working Hi, I while back ran you... started with
AJAX)), I was able to get it working. Just recently, I have been working on some additional development code using
AJAX and I was getting some
AjaxAjax how to impliment
ajax in registration table using
jsp-servlet
Ajax with java(using Dojo) - JSP-ServletAjax with java (using Dojo) Hi, In In place Edit Box,when I click "save" button how can I save the data in server side i.e
JSP or how can I call.... Is there a possibility for tutorial on Scriptaculous. us,for Java programmers
JSP Ajax FormAjax Form Example
This example explains you how to develop a form that populates dynamically
from the database though
Ajax call.
When user selects employee id from the combo box then the corresponding
employee details are populated
Combo Box Using Ajax In JSP Combo Box Using
Ajax In
JSP
In this section, we develop an application to
Select the Data from database using
Ajax in combo box. We created two file
AjaxAjax how to include
ajax in
jsp page?
Hi,
Please read
Ajax First Example - Print Date and Time example.ADS_TO_REPLACE_1
Instead of using PHP you can write your code in
JSP.
Thanks
Create Listbox in JSP using AJAX controlCreate Listbox in
JSP using
AJAX control Hi everyone!!!
I want... listbox to select single elemnt using
AJAX control . But i don't know anything about
AJAX.
In that listbox,listbox items are dictly fetched from databases
Popup Window using Ajax In JSP Popup Window using
Ajax In
JSP
... Window application
using
Ajax in
JSP. For this, we will create the following...("Insert")) {
%>
<
jsp:forward page="InsertData.jsp" />
ajax me reg this.
thanks
KK
Combobox box using
Ajax in
JSP
i...ajax HI,
In my application using
ajax if i type a managername in the textbox it should display all the employees under the that manager