This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

view record from database using click event in jsp

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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("jdbc:odbc: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 ++ ;
%>
<input type="button" value="next" onclick="move();"> <input type="hidden" name="hidden" value="<%=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>

reply
    Bookmark Topic Watch Topic
  • New Topic