File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes view record from database using click event in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "view record from database using click event in jsp" Watch "view record from database using click event in jsp" New topic
<input type="button" value="next" onclick="move();"> <input type="hidden" name="hidden" value="<%=cu%>"> <% }} %>

view record from database using click event in jsp

pradeepa sakthi

Joined: Dec 26, 2008
Posts: 11
hai to all,
please help me...
i want to retrieve record one by one from database when click button... here is my code..but not work well.. i think i did some mistake in it.but i do not know where it is.
my project has been delayed by this problem.. . please help
me...please guide me in right way...
Thank in advance...

<%@ page import="java.sql.*"%>


function move()
var cu = 0
cu = parseInt(document.form1.hidden.value) + 1
document.form1.hidden.value = cu


<FORM NAME="form1" ACTION="query.jsp" >

int cu=1;

Connection con=DriverManager.getConnection("jdbcdbc:tdsn");
if(request.getParameter("hidden") != null)

cu = Integer.parseInt(request.getParameter("hidden"));

String useri=request.getParameter("D1");

String a=request.getParameter("T1");
PreparedStatement ps=con.prepareStatement("SELECT sn,StrategicSite,City,CensusTower,Address,Lattitude,Longitude,SharingPartner,Site,RFI,BSC,SECA,SECB,SECC,sitetype,buildinght,towerht,sour,dg,Capa,bm,bcapa,ethiload,totalload,operator,Staus,Media,Id,Vendor,MW,SDH,sa,sb,sc,sd,se,sf,sg,sh,si FROM tower,basic,power,txd,Rfd where sitetype=? and basic.sid=tower.sid and tower.sid=power.sid and tower.sid=txd.sid and tower.sid=Rfd.sid");
ResultSet rs=ps.executeQuery();


String r=rs.getString("sitetype");
String d=rs.getString("buildinght");
String f=rs.getString("towerht");
String sn=rs.getString("sn");
String s=rs.getString("StrategicSite");

String s2=rs.getString("City");

String s5=rs.getString("CensusTower");
String s6=rs.getString("Address");
String s7=rs.getString("Lattitude");
String s8=rs.getString("Longitude");
String s9=rs.getString("SharingPartner");
String s10=rs.getString("Site");
String s11=rs.getString("RFI");
String s12=rs.getString("BSC");
String s13=rs.getString("SECA");
String s14=rs.getString("SECB");
String s15=rs.getString("SECC");
String p1=rs.getString("sour");
String p2=rs.getString("dg");
String p3=rs.getString("Capa");
String p4=rs.getString("bm");
String p5=rs.getString("bcapa");
String p6=rs.getString("ethiload");
String p7=rs.getString("totalload");
String p8=rs.getString("operator");
String p9=rs.getString("Staus");
String t1=rs.getString("Media");
String t2=rs.getString("ID");
String t3=rs.getString("Vendor");
String t4=rs.getString("MW");
String t5=rs.getString("SDH");
String sa=rs.getString("sa");
String sb=rs.getString("sb");
String sc=rs.getString("sc");
String sd=rs.getString("sd");
String se=rs.getString("se");
String sf=rs.getString("sf");
String sg=rs.getString("sg");
String sh=rs.getString("sh");
String si=rs.getString("si");
cu ++ ;
Basic & Bss Details Tower Details  Tx Details Power Details          Rf Details
Strategic Site <%=s%> Site Type <%=r%> Media <%=t1%>  Power Source


<%=p1%> Ant Ht Sec <%=sa%>
Sec <%=sb%>
City <%=s2%> Building HT
<%=d%> ETI E1 ID  ht   <%=t2%> DG Make <%=p2%>
Tower Ht <%=f%> Vendor <%=t3%>   Capa <%=p3%> Sec <%=sc%>
Census Tower <%=s5%>   Equip MW <%=t4%> Battery Make <%=p4%> Mech.Tilt Sec <%=sd%>
SDH <%=t5%> Capa <%=p5%> Sec <%=se%>
Address <%=s6%>   Ethisalat Load


<%=p6%> Sec


Total Load(Amps) <%=p7%> Elec.Tilt Sec <%=sg%>
Lattitude <%=s7%> External Alarm


Operator <%=p8%> Sec <%=sh%>
Longitude <%=s8%> Status <%=p9%> Sec <%=si%>
Sharing Partner <%=s9%>




Site <%=s10%> Survey    
RFI <%=s11%> RFI  
BSC <%=s12%> Integration  
TRX config Sec <%=s13%> On Air  
Sec <%=s14%>  
Sec <%=s15%>







I agree. Here's the link:
subject: view record from database using click event in jsp
It's not a secret anymore!