
Thank you for all your help.This problem i asked you many days before,but did not get some answer.i will be obliged if you throw some light on this issue.
I have a table in which there are electrical meters with their details.This table NEW_METER stores all the details of meters.All meters are diveide into three categories.11KV,33KV and >33kv.all meters should have a testing date.I have a page in which there are 3 options with radio button with all options. e.g- 11kv* 33kv* >33kv*
*=radio button
After clicking on that button it should fetch all the meters details,whose testing dates were one year before from today.e.g-If am checking on 11th Jan 2011,it should whose(11kv) testing dates sre before 11th Jan 2010.(compare years).It should fetch all tha details of that meter and should populate a table with print options.
I want to do it using ajax.
My table is CREATE TABLE HTNEWMETER ( ID NUMBER (10) NOT NULL, METERNO VARCHAR2 (30) NOT NULL, PONO VARCHAR2 (30) NOT NULL, STORENAME VARCHAR2 (20), DELIVERYDATE DATE, MAPPING_STATUS CHAR (1) DEFAULT 'N', METERTESTINGDATE DATE, KVARATINGID NUMBER,
Sir,please help me.It is utmost urgent.pLEASE HELP ME.
Regards

Hi Friend,
Try the following code:
1)radiobuttons.jsp:
<%@page import="java.sql.*"%>
<html>
<head>
<script type="text/javascript">
function showData(value){
alert("--------------"+value);
xmlHttp=GetXmlHttpObject()
var url="getInfo.jsp";
url=url+"?meter="+value;
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged() {
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("mydiv").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject(){
var xmlHttp=null;
try {
xmlHttp=new XMLHttpRequest();
}
catch (e) {
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
</head>
<body>
<input type="radio" value="11kv" id="radio" name="radio" onclick="showData(this.value);">11 KV<input type="radio" value="33kv" name="radio" id="radio" onclick="showData(this.value);">33 KV<input type="radio" value=">33kv" id="radio" name="radio" onclick="showData(this.value);">>33KV
<br><br>
<div id="mydiv"></div>
</body>
</html>
2)getInfo.jsp:
<%@page language="java" import ="java.sql.*, java.text.*,java.util.*" %>
<%
String fi=request.getParameter("meter");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c1 = Calendar.getInstance();
c1.set(2011, 0 , 11);
c1.add(Calendar.YEAR,-1);
String dd=sdf.format(c1.getTime());
String buffer="<table border='1'>";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select * from htnewmeter where METERTESTINGDATE<'"+dd+"' ");
while(rs.next()){
buffer=buffer+"<tr><td>"+rs.getString(1)+"</td><td>"+rs.getString(2)+"</td><td>"+rs.getString(3)+"</td><td>"+rs.getString(4)+"</td></tr>";
}
buffer=buffer+"</table>";
response.getWriter().println(buffer);
%>
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.