aspose file tools*
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%>"> <% }} %>
Author

view record from database using click event in jsp

pradeepa sakthi
Greenhorn

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.*"%>

<SCRIPT LANGUAGE="JavaScript">

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

</SCRIPT>

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

<%
int cu=1;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

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


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

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

if(useri.equals("SiteType"))
{
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");
ps.setString(1,a);
ResultSet rs=ps.executeQuery();

%>
<%
if(rs.next())
{

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

(Amps)

<%=p6%> Sec

 

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

(Extn)

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

                                   

              Dates

                  

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

 


 


 


 




</body>

</html>

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: view record from database using click event in jsp
 
Similar Threads
Table Allignment problem in IE 6.0
problem with java lib
Scrollbar for table using div doesnt work in IE
Converting data source
how to connect to database and display query vqlus using proper java/jsp