Академический Документы
Профессиональный Документы
Культура Документы
<html> <head> <title>Welcome</title> </head> <body bgcolor="white" text ="times new roman" scroll="yes" > <img src="D:\wt record\Example58\logo.bmp" width="100" height= "100" align="right"> </img> <br/> <font size ="16" face="times new roman" color="black"> <center><h1> DRKIST </h1></center> <br/> <font size="6" face="times new roman" color="black" > <marquee ><i> Welcome to DRK Institute </marquee></font> <h2> <i>welcome to DRK institute </h2> </font> <br><br><br><br><br><br><br><br> <br> <font size="3" face="times new roman" color="blue" > <p align= "right"><a href="c:/Example58/details.html"> Details </a> </font> <hr> <h6 align ="bottom" > All Rights Reserved </h6> </body> </html>
Aim: Program to display the static web pages (Home, Registration, Catalog, Cart) Source code: 1.Home:
<html> <head> <title> Welcome </title> </head> <body bgcolor="white" text ="times new roman" scroll="yes" > <img src="D:\wt record\Example58\logo.bmp" width="100" height= "100" align="right"> </img> <br/> <font size ="16" face="times new roman" color="black"> <center><h1> DRKIST </h1></center> <br/> <font size="6" face="times new roman" color="black" > <marquee ><i> Welcome to DRK Institute </marquee></font> <h2> <i>welcome to DRK institute </h2> </font> <br><br><br><br><br><br><br><br> <br> <font size="3" face="times new roman" color="blue" > <p align= "right"><a href="c:/Example58/details.html"> Details </a> </font> <hr> <h6 align ="bottom" > All Rights Reserved </h6> </body> </html>
2.Registration:
<html> <head> <title> login page </title> </head> <body bgcolor="white"> <form name="f1" method="post"> <p align="right">username<input type="text" name="t1" maxlength="20"> password<input type="password" name="t2" maxlength="20"><input type="submit" value="login"></form> <img src="logo.bmp" width="100" height= "100" align="right"> </img><br><br> <u><h1 align="center">LOGIN</h1></u><br>
<h3><u>About:</u></h3> <font size="2" face="verdana" color="black"> <i><b>DRK Institute of Science and Technology</b> is an Engineering college established in 2004.The college is affliated to <b>Jawaharlal Nehru Tecnological University Hyderabad</b>.It has been successfully training the students in the field of Engineering and Technology and provided the state many successful engineers. <br>To know more about the college and courses offered in the college please <u>sign up</u> to the site.If you are already a member please <u>sign in</u> to know the details.</i> </font> <br> <H3><u>SIGN UP</u></h3> <form name ="f2" method="post"> First name<input type="text" name="t1" maxlength="20"><br> <br> last name<input type="text" name="t3" maxlength="20"><br> <br> Email id<input type="text" name="t4" maxlength="20"><br> <br> User name<input type="text" name="t1" maxlength="20"><br> <br> password<input type="password" name="t2"maxlength="20"><br> <br> Re-typepassword<input type="password" name="t2"maxlength="20"> <br> <br> <input type="submit" value="submit"> <input type="reset"> </form> <hr></hr> <font size="1" face="verdana" color="black"> All rights reserved</font> </body> </html>
3.Catalog:
<html> <head> <title>catalogue</title> </head> <body bgcolor="white"> <table border="1" cellspacing="1" cellpadding="1"> <tr> <td><img src="logo1.jpg" width="100" height= "100" align="right"></img></td> <td>author:xxx <br>bname:xxxx<br> publisher:xxx<br></td> <td>cost</td>
<td><input type="submit" value="add to cart"></td> </tr> <tr> <td><img src="logo2.jpg" width="100" height= "100" align="right"></img></td> <td>author:xxx <br>bname:xxxx<br> publisher:xxx<br></td> <td>cost</td> <td><input type="submit" value="add to cart"></td> </tr> <tr> <td><img src="logo3.jpg" width="100" height= "100" align="right"></img></td> <td>author:xxx <br>bname:xxxx<br> publisher:xxx<br></td> <td>cost</td> <td><input type="submit" value="add to cart"></td> </tr> </body> </html>
4.Cart:
<html> <head> <title>cart</title> </head> <body bgcolor="white"> <table border="1" cellspacing="1" cellpadding="1"> <tr> <th>Book name</th> <th>price</th> <th>Quantity</th> <th>Amount</th> </tr> <td>bname:xxxx</td> <td>12</td> <td>x</td> <td>amount</td> </tr> </tr> <td>bname:xxxx</td> <td>12</td> <td>x</td> <td>amount</td> </tr> </table> </body> </html>
Aim: Program to implement Cascade Style Sheets (CSS) (Internal, External, Inline) Source code: External CSS:
<html> <head> <title>css example</title> <link rel="stylesheet" href="extcss.css"> </head> <body> <h3>welcome to css</h3> <a href="welcome1.html">home page</a> </body> </html>
CSS:
a:link{color:blue}; a:active{color:green}; a:visited{color:black}; a:hover{color:red};
Internal:
<html> <head> <title>welcome</title> </head> <style type="text/css"> body{background:white;color:red} a:link{color:green}; a:active{color:pink}; a:visit{color:black}; a:hover{color:blue}; </style> <body> <h3>working with style sheets</h3> <a href="ex.html">home page</a> </body> </html>
Inline:
<html> <head> <title>css</title> <style type="text/css"> body{background-image:logo1.bmp} .xlink{cursor:crosshair} .hlink{cursor:help} <div style="position:relative;top:10;background-color:blue;z-index:1;">layer 1</div> </style> </head> <body> <b> <a href="welcome.html"class="xlink">cross link</a> <br> <a href="help.html"class="hlink">help link</a> </b> <b class="headline">this is headline</b> </body> </html>
{ window.alert("Please enter a valid Phone No"); f1.t5.focus(); f1.t5.value=""; } } </script> </head> <body bgcolor="white"> <form name="f1" method="post"> <center><u>REGISTERATION PAGE</u></center><br><br> <center> <table cellspacing="15" cellpadding="5"> <tr> <td>Username</td><td><input type="text" name="t1" onblur="validate_username()"></td> </tr> <tr> <td>Password</td><td><input type="password" name="t2"></td></tr> <tr><td>ConfirmPassword</td><td><input type="password" name="t3"onblur="validate_password()"></td></tr> <tr><td>Email Id</td><td><input type="text" name="t4"onblur="validate_emailId()"></td></tr> <tr><td>Phone no.</td><td><input type="text" name="t5"onblur="validate_Phno()"></td> </tr> <tr><td>Gender</td><td><input type="radio" name="t6">Male<br> <input type="radio" name="t6">Female </td> </tr> <tr><td>Date of Birth</td> <td>Date: <select name="date"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option>
<option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> </select> Month: <select name="month" > <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> </select> Year: <select name="Year" > <option>1990</option> <option>1991</option> <option>1992</option> <option>1993</option> <option>1994</option> <option>1995</option> <option>1996</option> <option>1997</option> </select> </td> </tr> <tr> <td>Languages</td>
<td><input type="checkbox" name="c1" value="English">English<br> <input type="checkbox" name="c1">Hindi<br> <input type="checkbox" name="c1">telugu<br> </td> </tr> <tr> <td>Address</td><td><textarea rows="5" cols="18"></textarea></td> </tr> </table><br> <input type="button" value="submit"> <input type="reset"> </center> </body> </html>
Aim: Program to Create Calculator application with basic functionalities. Source code:
<html> <head> <title>CALCUALTOR</title> <script language="Javascript"> txtdata=""; function Cal(value) { txtdata=txtdata+value; document.f1.t1.value=txtdata; } </script> </head> <body> <form name="f1"> <table border=10 bgcolor="silver" bordercolor="silver"> <tr> <th>CALCULATOR</th> </tr> <tr> <td> <input type="text" maxlength="10" size="25" name="t1"> </td> </tr> <tr> <td> <input type="button" value=" 1 " onclick="Cal('1')"> <input type="button" value=" 2 " onclick="Cal('2')"> <input type="button" value=" 3 " onclick="Cal('3')"> <input type="button" value=" + " onclick="Cal('+')"> </td> </tr> <tr> <td> <input type="button" value=" 4 " onclick="Cal('4')"> <input type="button" value=" 5 " onclick="Cal('5')"> <input type="button" value=" 6 " onclick="Cal('6')"> <input type="button" value=" - " onclick="Cal('-')"> </td> </tr> <tr> <td> <input type="button" value=" 7 " onclick="Cal('7')"> <input type="button" value=" 8 " onclick="Cal('8')"> <input type="button" value=" 9 " onclick="Cal('9')">
<input type="button" value=" </td> </tr> <tr> <td> <input type="button" value=" <input type="button" value=" <input type="button" value=" <input type="button" value=" </td> </tr> </table> </form> </body> </html>
* " onclick="Cal('*')">
0 C = /
Aim: Program to check whether a given number is a palindrome or not. Source code:
<html> <head> <title> palindrome</title> </head> <body> <script language="javascript"> var s1=window.prompt("enter a number","0"); var a=parseInt(s1); var b=parseInt(s1); var r=0; var rev=0; while (a>0) { r=parseInt(a%10); rev=parseInt((rev*10)+r); a=parseInt(a/10); } document.writeln("original="+b); document.writeln("rev="+rev); if(b==rev) { document.writeln("given number is palindrome"); } else { document.writeln(" given number is not a palindrome"); } </script> </body> </html>
Aim: Program to display the Employee details using XML file. Source code:
HTML File: <html> <head> <title>records</title> <script language="javascript"> function First() { p.recordset.moveFirst; } function Next() { p.recordset.moveNext; if(p.recordset.EOF) { window.alert("last record"); p.recordset.moveLast; } } function Previous() { p.recordset.movePrevious; if(p.recordset.BOF) { window.alert("first record"); p.recordset.moveFirst; } } function Last() { p.recordset.moveLast; } </script> </head> <body> <form name="f1"> <xml id="p" src ="emp1.xml"></xml> <u>Employee Details</u> <table> <tr> <td>employee number</td><td><input type="text" name="t1" datasrc="#p" datafld="eno"></td></tr><br> <tr><td>employee name</td><td><input type="text" name="t2" datasrc="#p" datafld="ename"></td></tr><br>
<tr><td>employee salary</td><td><input type="text" name="t3" datasrc="#p" datafld="esal"></td></tr><br> <tr><td>department</td><td><input type="text" name="t4" datasrc="#p" datafld="dept"></td></tr><br> </table> <input type="button" value="First" onclick="First()"> <input type="button" value="Next" onclick="Next()"> <input type="button" value="Previous" onclick="Previous()"> <input type="button" value="Last" onclick="Last()"> </form> </body> </html> XML File: <EMP> <employee> <eno>1041</eno> <ename>ads</ename> <esal>34500</esal> <dept>cse</dept> </employee> <employee> <eno>1042</eno> <ename>absc</ename> <esal>32445</esal> <dept>it</dept> </employee> <employee> <eno>1043</eno> <ename>agc</ename> <esal>30345</esal> <dept>cse</dept> </employee> </EMP>
<esal>30005</esal> <dept>cse</dept> </employee> <employee> <eno>1047</eno> <ename>yxsc</ename> <esal>3000</esal> <dept>cse</dept> </employee> <employee> <eno>1048</eno> <ename>aExample</ename> <esal>30000</esal> <dept>cse</dept> </employee> <employee> <eno>1049</eno> <ename>sai</ename> <esal>325</esal> <dept>cse</dept> </employee> <employee> <eno>1050</eno> <ename>sudheer</ename> <esal>4000</esal> <dept>cse</dept> </employee> </EMP>
Aim: Program to display the number of root elements and to display the nodes. Source code:
Display the number of root elements: <html> <head> <title>DOM PARSER</title> <xml id="p" src="emp1.xml"></xml> <script language="javascript"> doc=p; if(doc.parseError!=0) { window.alert(doc.parseError.reason); } else { var rootE1=doc.documentElement; var childlist=rootE1.childNodes; document.writeln("<b>"+"the number of nodes for the root element in the xml document="+childlist.length+"</b>"+"<br>"); document.writeln("<b>"+"name of node is="+rootE1.lastChild.nodeName+"</b>"+"<br>"); } </script> </head> </html> Display the nodes. <html> <head> <title>DOM PARSER</title> <xml id="p" src="emp1.xml"></xml> <script language="javascript"> doc=p; var emplist; if(doc.parseError!=0) { window.alert(doc.parseError.reason); } else { emplist=doc.getElementsByTagName("employee"); for(var i=0;i<emplist.length;i++) { document.writeln(emplist.item(i).firstChild.firstChild.nodeValue+"<br>");
JDBC PROGRAMS Aim: Java Program to Create a table in SQL database. Source code:
import java.sql.*; public class tabemp { public static void main(String r[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Example","scott","tiger"); Statement st=con.createStatement(); st.executeUpdate("create table emp(eno number,ename varchar2(20),esal number,dept varchar2(10))"); System.out.println("Table is created"); } }
Aim: Write a Java Program to Insert values into SQL database. Source code:
import java.sql.*; public class insemp { public static void main(String r[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Example","scott","tiger"); Statement st=con.createStatement(); int i=st.executeUpdate("insert into emp values(561,'ram',4500,'it')"); if(i>0) System.out.println("1 row is inserted"); else System.out.println("error"); } }
Aim: Java Program to Select all rows of a table in SQL database. Source code:
import java.sql.*; public class selemp { public static void main(String r[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Example","scott","tiger"); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from emp"); while(rs.next()) System.out.println(rs.getInt(1)+"\t"+rs.getString(2)+"\t"+rs.getInt(3)+"\t"+rs.getString(4)); } }
Aim: Java Program to Update values taking input from Keyboard. Source code:
import java.sql.*; import java.io.*; public class kbupdemp { public static void main(String r[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Example","scott","tiger"); Statement st=con.createStatement(); InputStreamReader is=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(is); System.out.println("enter the amount to be updated"); int sal=Integer.parseInt(br.readLine()); int i=st.executeUpdate("update emp set esal=esal+"+sal+""); if(i>0) System.out.println("rows updated"+i); else System.out.println("error"); } }
Aim: Java Program to Delete values taking input from Keyboard. Source code:
import java.sql.*; import java.io.*; public class kbdelemp { public static void main(String r[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Example","scott","tiger"); Statement st=con.createStatement(); InputStreamReader is=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(is); System.out.println("enter the amount range that are to be deleted"); int amt=Integer.parseInt(br.readLine()); int i=st.executeUpdate("delete from emp where esal<"+amt+""); if(i>0) System.out.println("rows deleted="+i); else System.out.println("error"); } }
Aim: Java Program to Insert values into table through Command Prompt. Source code:
import java.sql.*; import java.io.*; import java.lang.*; public class cmdemp58 { public static void main(String r[ ])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Example","scott","tiger"); Statement st=con.createStatement(); int eno1=Integer.parseInt(r[0]); String ename1=r[1]; int esal1=Integer.parseInt(r[2]); String dept1=r[3]; int x=st.executeUpdate("Insert into emp values("+eno1+",'"+ename1+"',"+esal1+",'"+dept1+"')"); if(x>0) System.out.println("1 row is inserted"); else System.out.println("error"); } }
Aim: Java Program to Update values of a table through Command Prompt. Source code:
import java.sql.*; import java.io.*; import java.lang.*; public class cmdupdemp { public static void main(String r[ ])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Example","scott","tiger"); Statement st=con.createStatement(); int sal=Integer.parseInt(r[0]); int i=st.executeUpdate("update emp set esal=esal+"+sal+""); if(i>0) System.out.println("rows updated"+i); else System.out.println("error"); } }
Aim: Java Program to Delete values from table through Command Prompt. Source code:
import java.sql.*; import java.io.*; import java.lang.*; public class cmddelemp { public static void main(String r[ ])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Example","scott","tiger"); Statement st=con.createStatement(); int amt=Integer.parseInt(r[0]); int i=st.executeUpdate("delete from emp where esal<"+amt+""); if(i>0) System.out.println("rows deleted="+i); else System.out.println("error"); } }
Aim: Java Program to Insert values into a table using Prepared Statements. Source code:
import java.io.*; import java.sql.*; public class preinsert { public static void main(String args[])throws Exception { Class .forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:siva","scott","tiger"); PreparedStatement pt=con.prepareStatement("insert into emp593 values(?,?,?,?)"); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); while(true) { System.out.println("enter eno,ename,esal,dept"); int eno=Integer.parseInt(br.readLine()); String ename=br.readLine(); int esal=Integer.parseInt(br.readLine()); String dept=br.readLine(); pt.setInt(1,eno); pt.setString(2,ename); pt.setInt(3,esal); pt.setString(4,dept); pt.executeUpdate(); System.out.println("Do you want another (yes/no)"); String ch=br.readLine(); if(!ch.equalsIgnoreCase("yes")) break; } con.close(); } }
Aim: Java Program to Update values of a table using Prepared Statements. Source code:
import java.io.*; import java.sql.*; public class preupd { public static void main(String args[])throws Exception { Class .forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:siva","scott","tiger"); PreparedStatement pt=con.prepareStatement("update emp593 set esal=esal+(?) where eno=593"); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); while(true) { System.out.println("enter esal to be updated"); int esal=Integer.parseInt(br.readLine()); pt.setInt(1,esal); pt.executeUpdate(); System.out.println("do u want to continue(y/n)"); String ch=br.readLine(); if(!ch.equalsIgnoreCase("y")) break; } } }
Aim: Java Program to Delete values from a table using Prepared Statements. Source code:
import java.io.*; import java.sql.*; public class predel { public static void main(String args[])throws Exception { Class .forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:siva","scott","tiger"); PreparedStatement pt=con.prepareStatement("delete from emp593 where ename=(?)"); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); while(true) { System.out.println("enter ename to be deleted"); String ename=br.readLine(); pt.setString(1,ename); pt.executeUpdate(); System.out.println("do u want to continue(y/n)"); String ch=br.readLine(); if(!ch.equalsIgnoreCase("y")) break; } } }
Aim: Java Program to Select values from a table using Prepared Statements. Source code:
import java.sql.*; import java.io.*; import java.lang.*; public class Prep_select { public static void main(String args[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Emp","scott","tiger"); InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(isr); PreparedStatement ps=con.prepareStatement("select * from Employeewt where esal<? ") ; while(true) { System.out.println("enter esal for which selection is required"); int esal=Integer.parseInt(br.readLine()); ps.setInt(1,esal); ResultSet rs=ps.executeQuery(); while(rs.next()) { System.out.println(rs.getInt(1) +"\t" +rs.getString(2) +"\t" +rs.getInt(3) +"\t" +rs.getString(4)); } System.out.println("do you want to continue y/n"); String ch=br.readLine(); if(!ch.equalsIgnoreCase("y")) break; } } }
Aim: Java Program to Insert values into a table using Callable Statements. Source code:
import java.sql.*; class Stored_insert { public static void main(String args[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Emp","scott","tiger"); CallableStatement cst=con.prepareCall("{call insert_values()}"); cst.execute(); } }
Aim: Java Program to Update values of a table using Callable Statements. Source code:
import java.io.*; import java.sql.*; class Stored_update { public static void main(String args[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Emp","scott","tiger"); InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(isr); System.out.println("enter no"); int eno=Integer.parseInt(br.readLine()); CallableStatement cst=con.prepareCall("{call update_values(?,?)}"); cst.setInt(1,eno); cst.registerOutParameter(2,Types.INTEGER); cst.execute(); //System.out.println(cst.getInt(1)); } }
Aim: Java Program to Delete values from a table using Callable Statements. Source code:
import java.sql.*; class Stored_del { public static void main(String args[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Emp98","scott","tiger"); CallableStatement cst=con.prepareCall("{call del_values98()}"); cst.execute(); } }