You are on page 1of 56

CS2358 – INTERNET PROGRAMMING LABORATORY LABORATORY MANUAL FOR VI SEMESTER B.

E / CSE ACADEMIC YEAR: 2013 – 2014 (EVEN)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

GKM COLLEGE OF ENGINEERING & TECHNOLOGY CHENNAI-63

G.K.M. College of Engineering & Technology (Sponsored by SUGANTHI EDUCATIONAL TRUST) Alapakkam - Mappedu Road, G.K.M. Nagar, Chennai -600 063.

CS2358 – INTERNET PROGRAMMING LAB LABORATORY MANUAL

HEAD OF THE DEPARTMENT DEPT OF COMPUTER SCIENCE & ENGINEERING GKMCET

GENERAL INSTRUCTIONS FOR LABORATORY CLASSES
DO’S Without Prior permission do not enter into the Laboratory. While entering into the LAB students should wear their ID cards. The Students should come with proper uniform. Students should sign in the LOGIN REGISTER before entering into the laboratory. Students should come with observation and record note book to the laboratory. Students should maintain silence inside the laboratory. After completing the laboratory exercise, make sure to shutdown the system properly. DONT’S Students bringing the bags inside the laboratory wearing slippers/shoes insides the laboratory. Students using the computers in an improper way. Students scribbling on the desk and mishandling the chairs. Students using mobile phones inside the laboratory.

CS2358 – INTERNET PROGRAMMING LABORATORY

LIST OF EXPERIMENTS
1.Create a web page with the following using HTML i) To embed an image map in a web page ii) To fix the hot spots iii) Show all the related information when the hot spots are clicked. 2. Create a web page with all types of Cascading style sheets. 3. Client Side Scripts for Validating Web Form Controls using DHTML 4. Write programs in Java to create applets incorporating the following features: 5. Create a color palette with matrix of buttons Set background and foreground of the control text area by selecting a color from color palette. In order to select Foreground or background use check box control as radio buttons To set background images 6. Write programs in Java using Servlets: To invoke servlets from HTML forms To invoke servlets from Applets 7. Write programs in Java to create three-tier applications using JSP and Databases 1. 2. for conducting on-line examination. for displaying student mark list. Assume that student information is available in

database which has been stored in a database server. 8. Programs using XML – Schema – XSLT/XSL 9. Programs using AJAX 10. Consider a case where we have two web Services- an airline service and a travel agent and the travel agent is searching for an airline. Implement this scenario using Web Services and Data base.

TEXT BOOK: 1. Robert W.Sebesta, “Programming the world wide web”, Pearson Education, 2006.

Objective: To learn the concepts of website designing, client& server side programming and web services.

Session No

Exercise No

Exercises

Time Allocation

1

1

Simple Web page creation Create a web page with the following using HTML i) To embed an image map in a web page

150m

150m

2

2

ii) To fix the hot spots iii) Show all the related information when the hot spots are clicked.

3

3

Create a web page with all types of Cascading style sheets. 150m

4

4

Client Side Scripts for Validating Web Form Controls using DHTML 150m

Write programs in Java to create applets incorporating the following features: 5,6 5 Create a color palette with matrix of buttons 150m

for displaying student mark list.an airline service and a travel agent and the travel agent is searching for an airline.14 10 Implement this scenario using Web Services and Data base. 15 Model Examination 150m . for conducting on-line examination. b.10 7 a. 150m 13. Assume that student information is available in a database which has been stored in a database server.8 6 To invoke servlets from HTML forms To invoke servlets from Applets 150m Write programs in Java to create three-tier applications using JSP and Databases 9.Set background and foreground of the control text area by selecting a color from color palette. In order to select Foreground or background use check box control as radio buttons To set background images Write programs in Java using Servlets: 7. 150m 11 8 Programs using XML – Schema – XSLT/XSL 150m 150m 12 9 Programs using AJAX Consider a case where we have two web Services.

5.1) IMAGE MAPPING USING HTML AIM: Create a web page with the following using HTML    To embed an image map in a web page To fix the hot spots Show all the related information when the hot spots are clicked. shape – specifies the shape of the hotspots. STEPS: 1. Insert an image in the web page by using <img> element. attribute. Define an image map by using <map> element and use the name attribute to identify the image map. . 2. coords – specifies the coordinate values of the hotspots Use an image map with an <img> element by using the usemap 4. 3. Display the web page and click the hotspots to display the related information. Define the hotspots (certain areas of an image) by using <area> element with the following attributes:    href – specifies the target of the link.

. from Sanskrit</li> <li>India is the seventh-largest country by geographical area</li> <li>The second-most populous country with over 1..</title> </head> <body> <h1 align="center"><font face="Forte"color="violet">INDIA</font></h1> <hr> <p> <font size="3" face="Comic Sans MS"color="darkblue"> <ul> <li>The name India is derived from Indus. which is derived from the Old Persian word Hindu. from Sanskrit</li> </ul> <p> <font size="4" face="Calibri"color="red"> Click On The Hotspots To View More Information About That Particular Places..2 billion people</li> <li>The most populous democracy in the world</li> <li>Consisting of 28 states and seven union territories</li> <li>The name India is derived from Indus.PROGRAM: india. </font> </p> <map name="indiamap"> .html <html> <head> <title>Image Mapping.. which is derived from the Old Persian word Hindu..

jpg" border=0 usemap="#indiamap"> </body> </html> chennai.131" href="kolkatta.html" alt="Click here to get more details"> <area shape="rect" coords="84.</title> <body> <p><font face="Cambria" color="blue" size="3">Chennai.207" href="chennai.185. formerly known as Madras or Madarasapatinam.112....162" href="mumbai.63.html <html> <Title>Chennai.</font></p> <table> <tr> <td><img src="Parrys.<area shape="rect" coords="105.html" alt="Click here to get more details"> <area shape="rect" coords="57.157.html" alt="Click here to get more details"> </map> <img src="india.jpg"><br> <font face="Cambria" color="blue" size="3">Parry's Corner</td> <td> <font face="Cambria" color="blue" size="2"> <ul> <li>Chennai being the fourth most populous metropolitan area and the fifth most populous city in India</li> .89" href="delhi.126..84.html" alt="Click here to get more details"> <area shape="rect" coords="179.202.91.. is the capital city of the Indian state of Tamil Nadu.

home to most of the movie studios</li> </ul> </td> </tr> </table> <font face="Cambria" color="blue" size="2"> <a href="india..</title> <body> <p><font face="Cambria" color="blue" size="3">It is the most populous city in India. known as Kollywood. computer.<li>It is also the world's 36th largest metropolitan area</li> <li>Chennai's economy has a broad industrial base in the automobile.. and the second most populous city in the world. information technology (IT) and information-technology-enabled services (ITES)</li> <li>Chennai is a major centre for music.. with a population of approximately 14 million. technology... art and culture in India</li> <li>The city is known for its classical dance shows and Hindu temples</li> <li>Cricket is the most popular sport in Chennai</li> <li>Chennai is the base for the large Tamil movie industry.html <html> <Title>Mumbai.html">Home</a> </font> </body> </html> mumbai. hardware manufacturing.</font></p> <table> . and healthcare industries</li> <li>The city is India's second largest exporter of software.

formerly known as Bombay </li> <li>Mumbai is the capital of the Indian state of Maharashtra</li> <li>Mumbai is the commercial and entertainment capital of India</li> <li>The average annual temperature is 27.</title> <body> <p><font face="Cambria" color="blue" size="3">Delhi is the eighth largest metropolis in the world by population with more than 12.<tr> <td><img src="Gateway.25 million people.html <html> <Title>Delhi..html">Home</a> </font> </body> </html> delhi.</font></p> <table> <tr> ..0 °F)</li> </ul> </td> </tr> </table> <font face="Cambria" color="blue" size="2"> <a href="india.jpg"><br> <font face="Cambria" color="blue" size="3">Gateway Of India</td> <td> <font face="Cambria" color="blue" size="2"> <ul> <li>Mumbai..2 °C (81...

1 inches)</li> </ul> </td> </tr> </table> <font face="Cambria" color="blue" size="2"> <a href="india.<td><img src="LotusTemple. Gurgaon and Faridabad along with other smaller nearby towns</li> <li>Delhi has a maximum length of 51...jpg"><br> <font face="Cambria" color="blue" size="3">Lotus Temple</td> <td> <font face="Cambria" color="blue" size="2"> <ul> <li>Which also includes Noida.html">Home</a> </font> </body> </html> kolkatta....</font></p> <table> . Ghaziabad.</title> <body> <p><font face="Cambria" color="blue" size="3">Kolkata is the cultural capital of India and the commercial capital of Eastern India.html <html> <Title>Kolkata.9 km (32 mi) and the maximum width of 48. Greater Noida.48 km (30 mi)</li> <li>The annual mean temperature is 25 °C (77 °F)</li> <li>The average annual rainfall is approximately 714 mm (28.

html">Home</a> </font> </body> </html> .<tr> <td><img src="VictoriaMemorial.2 °F)</li> </ul> </td> </tr> </table> <font face="Cambria" color="blue" size="2"> <a href="india.jpg"><br> <font face="Cambria" color="blue" size="3">Victoria Memorial</td> <td> <font face="Cambria" color="blue" size="2"> <ul> <li>Kolkata. formerly known as Calcutta. is the capital of the Indian state of West Bengal</li> <li>Before 1690 Kolkata.8 °C (80. under direct rule of the Nawab of Bengal Siraj-UdDaulah</li> <li>Kolkata is located in the eastern part India</li> <li>The annual mean temperature is 26.

css‟. Declare an individual element‟s style by using „style‟ attribute (Inline style). Embed the entire style rules in an HTML document‟s head section (Embedded style) by using <style> element as follows. <link rel="stylesheet" type="text/css" href="extStyle.2)WEB PAGE USING CASCADING STYLE SHEETS(CSS) AIM: To create a web page with the following Cascading style sheets (CSS)    Inline style Embedded style External style STEPS: 1.css"/> .css) and HTML document by using <link> element as follows. <style type="text/css"> 3. 4. 2. Create the link between the external style rules (extStyle. Create the separate document that contain only CSS rules (External style) and save it as „extStyle.

width:800. Sachin Tendulkar is an Indian cricketer.jpg"></td> </tr> </table> <table id="tid2" align="Center"> <tr> <td class="cls1" valign="top"> <h3 style="font-family:Lucida Sans Unicode.PROGRAM: CSSDemo.font-family:Courier New.color:blue">Profile</h3> <p> Sachin Ramesh Tendulkar was born on 24 April 1973 in Mumbai.height:200} #tid2{background-color:gray.height:200} </style> <link rel="stylesheet" type="text/css" href="extStyle. He has been the most complete batsman of .css"/> </head> <body> <h1 style="text-align:center.html <html> <head> <title>Sachin Tendulkar</title> <style type="text/css"> #tid1{background-color:gray.color:blue">Sachin Ramesh Tendulkar</h1> <hr/> <table id="tid1" align="Center"> <tr> <td><img src="sachin.height:300} img{width:794.width:800.

000 runs in both ODIs and Test</li> <li>Highest batting average among batsmen with over 10. India‟s highest sporting honour.color:blue">Highlights of Tendulkar‟s Career</h3> <div style="font-size:10pt.textalign:justify"> <ul type="square"> <li>Highest number of Test centuries (51)</li> <li>Highest number of ODI centuries (49)</li> <li>First cricketer to cross 10. for 1997-1998.his time. highest by any one in a single Cricket World Cup</li> <li>First ceicketer to reach double century in ODI</li> <li>Played in the highest number of Cricket Grounds</li> <li>Rated as the second best batsman of all time (next to Don Bradman) by Wisden. He received the Rajiv Gandhi Khel Ratna. the highest by any player in an year</li> <li>673 runs in 2003 World Cup.000 ODI runs</li> <li>In 1998 he hit 9 ODI centuries. He holds several batting records. after Sir Don Bradman. </p> </td> <td class="cls1" valign="top"> <h3 style="font-family:Lucida Sans Unicode.</li> </ul> </div> .font-family:Lucida Sans Unicode. Tendulkar was a Wisden Cricketer of the Year in 1997. including the most Test centuries and the most one-day international centuries.color:gold. and was rated in 2002 by Wisden as the second greatest Test batsman ever. and the civilian award Padma Shri in 1999.

</td> </tr> </table> </body> </html> extStyle.font-size:12pt.cls1{width:325.height:300} p{font-family:Lucida Sans Unicode.color:silver.css body{background-color:black} .textalign:justify} .

onsubmit – to call the Java script validation function when the submit button is pressed. Insert all the necessary form elements such as <input>. Insert various types of input fields (such as text. Embed the form validation function within the head section of the HTMLdocument by using <script> element as follows: <script type="text/javascript"> . and <fieldset>. 4. 2. <select>. STEPS: 1. action – specifies the target of the form data to be submitted. and submit) by using „type‟ attribute of <input> element. radio. 3. <textarea>. checkbox. Insert a <form> element in the HTML document with the following attributes:    name – to identify the form element.3)WEB FORM VALIDATION USING JAVA SCRIPT AIM: To create a web form with client side validation using Java script.

} .email.f1.value=="") { window.value.addr.value=="") { window.alert("Plz Enter Your Address").alert("Plz Enter Your Name").f1. } else if(document.f1.PROGRAM: FormValidation. return false.alert("Plz Enter Your Valid E-mail").value=="") { window.email.alert("Plz Enter Your E-mail:"). } else if(document. } else if(document.html <html> <head> <title>Form Validation Using Java Script</title> <script type="text/javascript"> function validation() { if(document. return false.name.com')==-1) { window. return false.f1.indexOf('@gmail. return false.

} else if((document.selectedIndex==0) { window. return false.rdo[1].country. } else return true.rdo[0].checked==false)&&(document. } </script> </head> <body bgcolor="lightgreen"> <h3 style="text-align:center">Web Form Validation Using Java Script</h3> <form name="f1" action="Register.alert("Plz Choose Your Gender").html" onsubmit="return validation()"> <fieldset> <legend>Registration Form</legend> .f1.checked==f alse)) { window.f1.alert("Plz Select Your Qualification"). } else if((document.f1.checked==false)&&(document.chk[0].else if(document.f1.alert("Plz Select Your Country"). return false.f1.checked==f alse)) { window.chk[1]. return false.

<br/> <table border="1"> <tr> <td>Name:</td> <td><input type="text" name="name"></td> </tr> <tr> <td>E-mail:</td> <td><input type="text" name="email"></td> </tr> <tr> <td>Address:</td> <td><Textarea name="addr" rows="5" cols="20"></Textarea></td> </tr> <tr> <td>Country:</td> <td> <select name="country"> <option>---Select Your Country---</option> <option>India</option> <option>USA</option> <option>AUS</option> <option>UK</option> </select> </td> </tr> <tr> <td>Gender:</td> <td> .

..<input type="radio" name="rdo">Male <input type="radio" name="rdo">Female </td> </tr> <tr> <td>Qualification:</td> <td> <input type="checkbox" name="chk">B.!</h3> </body> </html> .E <input type="checkbox" name="chk">M..E </td> </tr> </table> <br/> <input type="submit" value="Register"> </fieldset> </form> </body> </html> Register....html <html> <head> <title>Registration Successfull</title> </head> <body> <h3>Registered Successfully.

9. CheckboxGroup. Add all the controls by using the init() method of Applet class. Make the frame visible by using the method setVisible(). Import all necessary packages and classes. 7. Make the controls to listen the action by using the method addActionListener(). 6. Set the background color for each buttons by using the method setBackground(). 8. Set background and Foreground of the control text area by selecting a color from color palette. change the foreground of the control TextArea. 2. If the item state value s=1. Define a class CPalette that extends Applet and implements the interfaces ActionListener and ItemListener. 3. If the item state value s=2. 4.4) COLOR PALETTE USING JAVA AIM: To write the java program to create applets incorporating the following features:   Create a color palette with matrix of buttons. 10.  In order to select Foreground or background use check box control as radio buttons. Define the objects for the controls such as Button. 5. Arrange all the controls by using the method setBounds(). . ALGORITHM: 1. Checkbox and TextArea. change the background of the control TextArea.

applet. add(b1).c2.blue). public class CPalette extends Applet implements ActionListener.setBackground(Color.3.*. .50.event. PROGRAM: CPalette.b3. public void init() { setLayout(null). b2=new Button(). b1.1\bin>javac CPalette.25).*. b1=new Button().50.*.awt.addActionListener(this). import java.b2. TextArea ta.setBounds(50.java) by using the following C:\jdk1. import java.awt. int s.java import java.11.html”. Compile the java file (CPalette. Checkbox c1. CheckboxGroup cg.html) in Internet Explorer. 13.ItemListener { Button b1. b1.b4. Create the <applet> code and save it as “ColorPalette. b1.java command line: 12. Run the HTML file (ColorPalette.

addActionListener(this).setBackground(Color. add(c1). b4=new Button().250.red). add(b3).100.50.100. b3. b2.200.setBackground(Color.setBounds(50.setBounds(120.addActionListener(this). b4. c1=new Checkbox("Background". b2.setBackground(Color.95.black). add(b4).25). add(c2).setBounds(50.50.25). b4.95.setBounds(120.150. c1.add(b2).setBounds(150.false). c1.addActionListener(this).120).addItemListener(this). } public void itemStateChanged(ItemEvent ie) .cg.25).addItemListener(this).50.50.25).cyan).120. c2=new Checkbox("Foreground". cg=new CheckboxGroup(). ta. ta=new TextArea().cg. b2. b3. c2. b3. setVisible(true). add(ta). b3=new Button().setBounds(50.25).false). c2. b4.

{ if(c1. if(c2.getSource()==b3) ta.cyan).black).red).cyan).setBackground(Color.setBackground(Color. . else if(ae. else ta.getSource()==b3) ta.getSource()==b1) ta.setBackground(Color.blue).getSource()==b2) ta.red).getSource()==b1) ta. else if(ae.getState()==true) s=2. } public void actionPerformed(ActionEvent ae) { if(s==1) { if(ae.setBackground(Color.getState()==true) s=1.setForeground(Color. else if(ae.setForeground(Color.black).blue). else ta. } if(s==2) { if(ae. else if(ae.getSource()==b2) ta.setForeground(Color.setForeground(Color.

class" width="300" height="400"> .} } } ColorPalette.html <html> <head> <title>Color Palette Demonstration</title></head> <body bgcolor="lightblue"> <applet </applet> </body> </html> code="CPalette.

 Get the parameter values from the HTML forms by using the method getParameter().  Write a java servlet program (server. 2. Run the HTML program (client.java) with the following: Define a class server that extends the property of the class GenericServlet.  Get the parameter names from the HTML form by using the method getParameterNames().html).  Handle the request from the client by using the method service() of GenericServlet class. 3. Submit the form data to the server.5) INVOKING SERVLETS FROM HTML FORM AIM: To write a java program to invoke servlets from HTML forms. ALGORITHM: 1.html) with the following:  Insert a <form> that contains the fields such as text. .  Set the URL of the server as the value of form‟s action attribute. Compile the java source code (server. Write a client side HTML program (client.  Send the response to the client by using the method of PrintWriter class. password and one submit button.java). 5. 4.

html <html> <head> <title>Invoking Servlet From HTML</title> </head> <body> <form <fieldset> <legend>Login</legend> <table> <tr> <td>E-mail:</td> <td><input </tr> <td>Password:</td> <td><input </tr> <tr> <td><input </tr> </table> </fieldset> </form> </body> </html> type="submit" Value="Login"></td> type="password" name="Password" size="25"></td> type="text" name="LoginID" size="25"/></td> name="form1" method="post" action="http://localhost:8080/servlets-examples/servlet/server"> .PROGRAM: client.

import javax. pw.getWriter().hasMoreElements()) { String str1=(String)e.java import java.*.getParameter(str1).print("<h3><u>Login Details</u></h3>"). public class server extends GenericServlet { public { PrintWriter pw=res.*..print(str1+"="+str2+"<br/>"). } pw.nextElement().*..getParameterNames().server.util. pw.close(). while(e.print("<h2>Logged in Successfully.servlet. } } void service(ServletRequest req.ServletResponse res)throws ServletException. pw. String str2=req.IOException . Enumeration e=req.io. import java.</h2>").

5.6) INVOKING SERVLETS FROM APPLETS AIM: To write a java applet program that invokes servlet. Run the HTML file (AppletClient.html) that contains the applet tag and pass the class name to that applet code. Create an HTML file (AppletClient.  Define the objects for Button and add the button in the init() method of Applet class. Write a simple servlet program (MyServer.  Set the URL of the servlet program by using the object of the class URL.html) that contains the corresponding applet code. 3. Write a java applet program (AppletClient.java) that contains any response message. 4.  Define the object for AppletContext and display the response from the server using the method showDocument(). 2. .java) with the following:  Define the class AppletClient which extends the property of the class Applet and implements the interface ActionListener.  Make the button to listen the action by using the method addActionListener(). Click the button on the applet window in order to invoke the servlet program. ALGORITHM: 1.

*.java import java.io. } public void actionPerformed(ActionEvent ae) { try { AppletContext ac=getAppletContext().*.*.applet.*.addActionListener(this). URL u=new URL("http://localhost:8080/servletsexamples/servlet/MyServer"). } catch(Exception e) { . ac. import java. public class AppletClient extends Applet implements ActionListener { public void init() { Button b1=new Button("Click Here to Access Date Information from Server").PROGRAM: AppletClient. b1.black).event. b1. add(b1). b1. import java. import java.awt.setForeground(Color.showDocument(u).net.*.setBackground(Color.red).awt. import java.

public class MyServer extends GenericServlet { public void service(ServletRequest req.java import java. import javax.System. pw. } } } AppletClient. }} . Date d=new Date().servlet.println(e).io.util.getWriter().class" width="300" height="100"> </applet> </body> </html> MyServer.ServletResponse res)throws ServletException.out.println("<b>"+d+"</b>").IOException { PrintWriter pw=res. pw.html <html> <head> <title>Invoking Servlets From Applet</title> </head> <body> <applet code="AppletClient.println("<h3>Current Date and Time From Server:</h3>").*.*.*. import java.

Match the answers with the correct answers are available inthe database table.jsp) as the value of the action attribute. 2. ALGORITHM: 1. Server displays the mark and result to the client as a response. Set the URL of the server (ExamServer.   For each correct answer increment the mark by 5.7) ONLINE EXAMINATION USING JSP AIM: To create a three tier application for conducting online examination using JSP and database. . Retrieve the answers from the database.    Create the JSP file with the following Read the input from the client. Use radio buttons to make various options for the questions.html) with the following Create a form to get the input from the user.    Design the HTML page (ExamClient.  Use submit button to invoke the server and send the form data to the server.

C++ was developed by?<br/> <input type="radio" name="ans2" value="Dennis Ritchie">Dennis Ritchie <input type="radio" name="ans2" value="None">None <input type="radio" name="ans2" value="David Ritchie">David Ritchie <input type="radio" name="ans2" value="John">John <br/><br/> .jsp"> 1.PROGRAM: ExamClient.html <html> <head> <title>Online Exam Client</title> <style type="text/css"> body{background-color:black.Who is called as the father of computer?<br/> <input type="radio" name="ans1" value="Sachin">Sachin <input type="radio" name="ans1" value="Stuart">Stuart <input type="radio" name="ans1" value="Charles Babbage">Charles Babbage <input type="radio" name="ans1" value="Napier">Napier <br/><br/> 2.color:blue} </style> </head> <body> <h2 style="text-align:center">ONLINE EXAMINATION</h2> <h3>Answer the following questions (5 marks for each correct answer)</h3> <hr/> <form name="examForm" method="post" action="ExamServer.font-family:courier.

*"%> <html> <head> <title>Online Exam Server</title> <style type="text/css"> body{background-color:black.3.sql.font-family:courier.jsp <%@page contentType="text/html" language="java" import="java.html">Back To Main Page</a> </p> <hr/> <% .color:blue} </style> </head> <body> <h2 style="text-align:center">ONLINE EXAMINATION</h2> <p> <a href="ExamClient.C was developed by?<br/> <input type="radio" name="ans3" value="Dennis Ritchie">Dennis Ritchie <input type="radio" name="ans3" value="Stroustrup">Stroustrup <input type="radio" name="ans3" value="David Ritchie">David Ritchie <input type="radio" name="ans3" value="Charles Babbage">Charles Babbage <br/><br/> <input type="submit" value="Check Your Result"/> </form> </body> </html> ExamServer.

String str3=request.executeQuery("SELECT * FROM examTab"). int mark=0.odbc.getConnection("jdbc:odbc:examDS").equals(dbans1)) { mark=mark+5.equals(dbans2)) { mark=mark+5.String str1=request. if(str2.next()) { if(i==1) { String dbans1=rs. Class.JdbcOdbcDriver").getString(1). Statement stmt=con. if(str1. } } if(i==2) { String dbans2=rs. String str2=request. } } if(i==3) { . Connection con=DriverManager. while(rs.getParameter("ans3"). int i=1.forName("sun.createStatement().jdbc.getString(1).getParameter("ans2"). ResultSet rs=stmt.getParameter("ans1").

!! You Are Not Eligible For The Next Round.</h3>").</h3>")..println("<h4>Your Mark is : "+mark+"</h4>").. out.. if(str3... } } i++.! You Are Eligible For The Next Round... } else { out.println("<h4>Your Mark Is : "+mark+"</h4>").equals(dbans3)) { mark=mark+5.. out..println("<h3>Sorry.. } if(mark>=10) { out.getString(1). } %> </body> </html> .String dbans3=rs.println("<h3>Congratulations.

Database Name: examDB.accdb Table Name: examTab .

html) with the following Create a form to get the input (Register Number) from the user. ALGORITHM: 1. Set the URL of the server (marklist.   Design the HTML page (stud.jsp) as the value of the action attribute. .8) DISPLAYING STUDENT MARK LIST USING JSP AIM: To create a three tier application for displaying student mark list using JSP and database.  Use submit button to invoke the server and send the form data to the server.  Create the JSP file with the following Read the parameter value (Register Number) from the form by using the method getParameter().  Displays the mark list to the client as the response.  Retrieves the details from the database table with respect to the form input. 2.

&nbsp.&nbsp.html <html> <head> <title>Three Tier Application</title> <style type="text/css"> body{color:blue.&nbsp.&nbsp. &nbsp.jsp"> Enter Your Reg. <input type="submit" value="SUBMIT"/> </form> </body> <html> marklist.PROGRAM: stud.font-family:courier.&nbsp.*"%> <html> <head> <title>Three Tier Application</title> .sql.&nbsp.&nbsp.&nbsp.jsp <%@ page contentType="text/html" language="java" import="java.No: <input type="text" name="regno"/><br/><br/> &nbsp.text-align:center} </style> </head> <body> <h2>EXAMINATION RESULT</h2><hr/> <form name="f1" method="get" action="marklist.

getObject(2)%><br/> <table border="1"> <th>SUBJECT</th><th>Mark</th> <tr><td>Artificial Intelligence</td><td><%=rs.font-family:courier.getObject(7)%></td></tr> . Class.JdbcOdbcDriver"). while(rs.next()) { %> Register No:<%=rs.getParameter("regno"). Statement stmt=con.getObject(4)%></td></tr> <tr><td>Advanced Computer Architecture</td><td><%=rs.createStatement(). ResultSet rs=stmt.odbc. Connection con=DriverManager.text-align:center} </style> </head> <body> <h2>EXAMINATION RESULT</h2><hr/> <% String str=request.jdbc.executeQuery("SELECT*FROM markTab WHERE rno="+str).getObject(5)%></td></tr> <tr><td>Principles of Compiler Design</td><td><%=rs.getObject(1)%><br/> Name:<%=rs.getObject(6)%></td></tr> <tr><td>Web Technology</td><td><%=rs.getObject(3)%></td></tr> <tr><td>Object Oriented Analysis and Design</td><td><%=rs.forName("sun.getConnection("jdbc:odbc:markDS").<style type="text/css"> body{color:blue.

html">Back</a> </body> </html> .getObject(8)%></td></tr> </table> <% } %> <br/> <a href="stud.<tr><td>Unix Internals</td><td><%=rs.

Associate style sheet (XSL) with XML using the markup <?xml- stylesheet> 4. Create an XML document (stud.xsl) that defines the style to display an XML document. 2. 3.xml) that contains the markup tags such as <name>.xml) in the browser.9) DISPLAYING STUDENT DETAILS USING XML AND XSLT AIM: To write the programs using XML and XSLT for displaying student details. . <dept>. Load the XML document (stud. ALGORITHM: 1. Create an XSL document (stud. and <rno>.

w3.PROGRAM: stud.xsl"?> <studInfo> <stud> <name>Name1</name> <dept>CSE</dept> <rno>97709104001</rno> </stud> <stud> <name>Name2</name> <dept>CSE</dept> <rno>97709104002</rno> </stud> <stud> <name>Name3</name> <dept>CSE</dept> <rno>97709104003</rno> </stud> </studInfo> stud.0" xmlns:xsl="http://www.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="stud.org/1999/XSL/Transform"> .xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:transform version="1.

Transformation</title> </head> <body> <table border="1"> <caption>Student Details</caption> <tr> <th>Name</th><th>Department</th><th>Register No</th> </tr> <xsl:for-each select="/studInfo/stud"> <tr> <td><xsl:value-of select="name"/></td> <td><xsl:value-of select="dept"/></td> <td><xsl:value-of select="rno"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:transform> .w3.org/1999/xhtml"> <head> <title>Student Details .<xsl:template match="/"> <html xmlns="http://www.

2.xml <?xml version="1. PROGRAM: rank. Associate style sheet (XSL) with XML using the markup <?xml- stylesheet> 4. ALGORITHM: 1. and <country>. Load the XML document (rank. <name>.xsl"?> <rankInfo> <player> <rank>1</rank> <name>H.De Villiers</name> . Create an XSL document (rank.xsl) that defines the style to display an XML document.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="rank.B. 3.10) DISPLAYING RANKING DETAILS USING XML AND XSLT AIM: To write the programs using XML and XSLT for displaying player ranking details.Amla</name> <country>SA</country> </player> <player> <rank>2</rank> <name>A.xml) that contains the markup tags such as <rank>.M. Create an XML document (rank.xml) in the browser.

S.Kohli</name> <country>IND</country> </player> <player> <rank>4</rank> <name>K.Sangakkara</name> <country>SL</country> </player> <player> <rank>5</rank> <name>M.C.<country>SA</country> </player> <player> <rank>3</rank> <name>V.Dhoni</name> <country>IND</country> </player> </rankInfo> .

Transformation</title> </head> <body> <table border="1"> <caption>ICC Player Rankings</caption> <tr> <th>Rank</th><th>Name</th><th>Country</th> </tr> <xsl:for-each select="/rankInfo/player"> <tr> <td><xsl:value-of select="rank"/></td> <td><xsl:value-of select="name"/></td> <td><xsl:value-of select="country"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:transform> .rank.w3.0" xmlns:xsl="http://www.w3.xsl <?xml version="1.org/1999/XSL/Transform"> <xsl:template match="/"> <html xmlns="http://www.0" encoding="UTF-8"?> <xsl:transform version="1.org/1999/xhtml"> <head> <title>Student Details .

Call the function getContent() with respect to the onmouseover event. AJAX Call the function diplayProfile() with respect to the event onreadystatechange. and Opera).  Create the object for XMLHttpRequest (for modern browsers such as IE7+. Insert some images of cricket players.  Create the object for ActiveXObject (for older versions of browsers such as IE5 and IE6). 2. Firefox.  Call the function clearContent() with respect to the onmouseout event.   Receive the response with the use of responseText Property. ALGORITHM: 1. . Chrome.11) DISPLAYING CRICKET PLAYERS PROFILE USING AJAX AIM: To write a program using AJAX for displaying cricket players profile. The function accepts an argument that is the URL of another page contains the information about the player. insert AJAX based JavaScript code with the following.html) with the following. Safari.  AJAX send the request with the use of send() and open() methods. Within this XHTML document.   Create an XHTML document (AjaxDemo.

open('POST'.</title> <style type="text/css"> .box{border:1px solid blue.responseText.XMLHTTP")..html <html> <head> <title>Ajax Demo. req.innerHTML=req.onreadystatechange=diplayProfile.getElementById('contentArea')..XMLHttpRequest) { req=new XMLHttpRequest(). } else if(window. } function diplayProfile() { if(req.readyState==4) { document. req. function getContent(url) { if(window. .PROGRAM: AjaxDemo.true).send(null).url. } req.padding:10px} </style> <script type="text/javascript"> var req.ActiveXObject) { req=new ActiveXObject("Microsoft.

html")' onmouseout='clearContent()'/> <img src="yuvi.jpg" height="95" width="80" onmouseover='getContent("dhoni.} } function clearContent() { document.jpg" height="95" width="80" onmouseover='getContent("raina. } </script> </head> <body bgcolor="cyan"> <h1>Mouse over the image for More Information</h1> <img src="sachin.getElementById('contentArea').html")' onmouseout='clearContent()'/> <img src="veeru.innerHTML=''.jpg" height="95" width="80" onmouseover='getContent("veeru.html")' onmouseout='clearContent()'/> <img src="dravid.html")' onmouseout='clearContent()'/> <img src="kohli.html")' onmouseout='clearContent()'/> <div class="box" id="contentArea"/> </body> </html> .html")' onmouseout='clearContent()'/> <img src="raina.jpg" height="95" width="80" onmouseover='getContent("dravid.jpg" height="95" width="80" onmouseover='getContent("sachin.html")' onmouseout='clearContent()'/> <img src="dhoni.jpg" height="95" width="80" onmouseover='getContent("kohli.jpg" height="95" width="80" onmouseover='getContent("yuvi.

Bombay (now Mumbai). Legbreak googly </body></html> dravid. 1973. Asia XI. Rajasthan Royals. Yorkshire<br/><br/> <b>Nickname:</b> Tendlya. Karnataka. Maharashtra<br/><br/> <b>Major teams:</b> India. Mumbai Indians. Royal Challengers Bangalore<br/><br/> <b>Nickname:</b> The Wall<br/><br/> <b>Playing role:</b> Top-order batsman<br/><br/> <b>Batting style:</b> Right-hand bat<br/><br/> <b>Bowling style:</b> Right-arm offbreak </body> . Scotland. Little Master<br/><br/> <b>Playing role:</b> Top-order batsman<br/><br/> <b>Batting style:</b> Right-hand bat<br/><br/> <b>Bowling style:</b> Right-arm offbreak. Mumbai. Asia XI. Marylebone Cricket Club. ICC World XI. 1973.html <html> <body> <b>Full name:</b> Rahul Sharad Dravid<br/><br/> <b>Born:</b> January 11. Madhya Pradesh <br/><br/> <b>Major teams:</b> India. Kent.html <html> <body> <b>Full name:</b> Sachin Ramesh Tendulkar<br/><br/> <b>Born:</b> April 24.sachin. Indore.

Delhi. Indian Board President's XI. India Under-19s. Royal Challengers Bangalore<br/><br/> <b>Playing role:</b>Middle-order batsman<br/><br/> <b>Batting style:</b>Right-hand bat<br/><br/> <b>Bowling style:</b>Right-arm medium </body> </html> raina.html <html> <body> <b>Full name:</b> Suresh Kumar Raina<br/><br/> <b>Born:</b>November 27. Uttar Pradesh Under-16s<br/><br/> <b>Playing role:</b>Middle-order batsman<br/><br/> <b>Batting style:</b>Left-hand bat<br/><br/> <b>Bowling style:</b> Right-arm offbreak </body> . Ghaziabad. India Red. India Blue.</html> kohli. Chennai Super Kings. Delhi<br/><br/> <b>Major teams:</b>India. Muradnagar.html <html> <body> <b>Full name:</b> Virat Kohli<br/><br/> <b>Born:</b>November 5. 1986. Uttar Pradesh<br/><br/> <b>Major teams:</b>India. India Under19s. Rajasthan Cricket Association President's XI. Uttar Pradesh. 1988.

Delhi. Delhi<br/><br/> <b>Major teams:</b>India. Asia XI. Pune Warriors. Rajasthan Cricket Association President's XI<br/><br/> <b>Playing role:</b>Top-order batsman<br/><br/> <b>Batting style:</b>Right-hand bat<br/><br/> <b>Bowling style:</b>Right-arm offbreak </body> </html> . 1981. Chandigarh<br/><br/> <b>Major teams:</b>India. 1978. Kings XI Punjab. ICC World XI. India Blue. Yorkshire<br/><br/> <b>Playing role:</b>Middle-order batsman<br/><br/> <b>Batting style:</b>Left-hand bat<br/><br/> <b>Bowling style:</b>Slow left-arm orthodox </body> </html> veeru. Asia XI.</html> yuvi. Punjab.html <html> <body> <b>Full name:</b>Virender Sehwag<br/><br/> <b>Born:</b>October 20. Delhi Daredevils.html <html> <body> <b>Full name:</b>Yuvraj Singh<br/><br/> <b>Born:</b>December 12. Leicestershire.

Jharkhand<br/><br/> <b>Playing role:</b>Wicketkeeper batsman<br/><br/> <b>Batting style:</b>Right-hand bat<br/><br/> <b>Bowling style:</b>Right-arm medium </body> </html> . Bihar.dhoni.html <html> <body bgcolor="cyan"> <b>Full name:</b> Mahendra Singh Dhoni<br/><br/> <b>Born:</b>July 7. Ranchi. Chennai Super Kings. Asia XI. Bihar (now Jharkhand)<br/><br/> <b>Major teams:</b>India. 1981.