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

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.for displaying student mark list.Set background and foreground of the control text area by selecting a color from color palette.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. 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. 15 Model Examination 150m .14 10 Implement this scenario using Web Services and Data base.10 7 a.an airline service and a travel agent and the travel agent is searching for an airline. b. 150m 13. for conducting on-line examination. Assume that student information is available in a database which has been stored in a database server.

Display the web page and click the hotspots to display the related information. . Define an image map by using <map> element and use the name attribute to identify the image map. 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. 2. attribute. coords – specifies the coordinate values of the hotspots Use an image map with an <img> element by using the usemap 4. shape – specifies the shape of the hotspots. 3. Define the hotspots (certain areas of an image) by using <area> element with the following attributes:    href – specifies the target of the link. STEPS: 1. Insert an image in the web page by using <img> element.

</font> </p> <map name="indiamap"> . 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.PROGRAM: india.</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.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.html <html> <head> <title>Image Mapping... which is derived from the Old Persian word Hindu.. from Sanskrit</li> <li>India is the seventh-largest country by geographical area</li> <li>The second-most populous country with over 1.

.html" alt="Click here to get more details"> </map> <img src="india.. formerly known as Madras or Madarasapatinam.html" alt="Click here to get more details"> <area shape="rect" coords="84.162" href="mumbai.131" href="kolkatta. is the capital city of the Indian state of Tamil Nadu.html <html> <Title>Chennai..126..202.</font></p> <table> <tr> <td><img src="Parrys.89" href="delhi.207" href="chennai.63.84.185.html" alt="Click here to get more details"> <area shape="rect" coords="57.jpg" border=0 usemap="#indiamap"> </body> </html> chennai.</title> <body> <p><font face="Cambria" color="blue" size="3">Chennai.157.91..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> .html" alt="Click here to get more details"> <area shape="rect" coords="179.112.<area shape="rect" coords="105.

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

.<tr> <td><img src="Gateway.jpg"><br> <font face="Cambria" color="blue" size="3">Gateway Of India</td> <td> <font face="Cambria" color="blue" size="2"> <ul> <li>Mumbai.25 million people...html">Home</a> </font> </body> </html> delhi. 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.2 °C (81..</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..0 °F)</li> </ul> </td> </tr> </table> <font face="Cambria" color="blue" size="2"> <a href="india.html <html> <Title>Delhi.</font></p> <table> <tr> .

Ghaziabad. Gurgaon and Faridabad along with other smaller nearby towns</li> <li>Delhi has a maximum length of 51. Greater Noida.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...</font></p> <table> .<td><img src="LotusTemple.9 km (32 mi) and the maximum width of 48..html">Home</a> </font> </body> </html> kolkatta.</title> <body> <p><font face="Cambria" color="blue" size="3">Kolkata is the cultural capital of India and the commercial capital of Eastern India.1 inches)</li> </ul> </td> </tr> </table> <font face="Cambria" color="blue" size="2"> <a href="india...html <html> <Title>Kolkata.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.

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.html">Home</a> </font> </body> </html> .<tr> <td><img src="VictoriaMemorial. formerly known as Calcutta. is the capital of the Indian state of West Bengal</li> <li>Before 1690 Kolkata.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.

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. 2.css) and HTML document by using <link> element as follows. Embed the entire style rules in an HTML document‟s head section (Embedded style) by using <style> element as follows. Declare an individual element‟s style by using „style‟ attribute (Inline style).css‟.css"/> . 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. <link rel="stylesheet" type="text/css" href="extStyle. 4. <style type="text/css"> 3.

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

He received the Rajiv Gandhi Khel Ratna. and was rated in 2002 by Wisden as the second greatest Test batsman ever. He holds several batting records.font-family:Lucida Sans Unicode. for 1997-1998. </p> </td> <td class="cls1" valign="top"> <h3 style="font-family:Lucida Sans Unicode. 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. after Sir Don Bradman.000 runs in both ODIs and Test</li> <li>Highest batting average among batsmen with over 10.color:blue">Highlights of Tendulkar‟s Career</h3> <div style="font-size:10pt. and the civilian award Padma Shri in 1999. India‟s highest sporting honour.000 ODI runs</li> <li>In 1998 he hit 9 ODI centuries. including the most Test centuries and the most one-day international centuries.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.color:gold. the highest by any player in an year</li> <li>673 runs in 2003 World Cup.</li> </ul> </div> .his time. Tendulkar was a Wisden Cricketer of the Year in 1997.

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

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

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

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

<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> .

!</h3> </body> </html> .E </td> </tr> </table> <br/> <input type="submit" value="Register"> </fieldset> </form> </body> </html> Register.<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.E <input type="checkbox" name="chk">M......html <html> <head> <title>Registration Successfull</title> </head> <body> <h3>Registered Successfully..

Add all the controls by using the init() method of Applet class. 7. . If the item state value s=2. 4. Set background and Foreground of the control text area by selecting a color from color palette. 10. Import all necessary packages and classes.  In order to select Foreground or background use check box control as radio buttons. 3. Define a class CPalette that extends Applet and implements the interfaces ActionListener and ItemListener. 6. CheckboxGroup. Checkbox and TextArea. 5. Define the objects for the controls such as Button. Make the controls to listen the action by using the method addActionListener(). If the item state value s=1. Make the frame visible by using the method setVisible(). 2. 8. change the foreground of the control TextArea. ALGORITHM: 1. change the background of the control TextArea. 9. Arrange all the controls by using the method setBounds().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. Set the background color for each buttons by using the method setBackground().

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

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

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

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

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

PROGRAM: client.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"> .

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

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

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

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

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

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.jsp"> 1.font-family:courier.html <html> <head> <title>Online Exam Client</title> <style type="text/css"> body{background-color:black.PROGRAM: ExamClient.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.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 <%@page contentType="text/html" language="java" import="java.3.font-family:courier.*"%> <html> <head> <title>Online Exam Server</title> <style type="text/css"> body{background-color:black.color:blue} </style> </head> <body> <h2 style="text-align:center">ONLINE EXAMINATION</h2> <p> <a href="ExamClient.html">Back To Main Page</a> </p> <hr/> <% .sql.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.

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

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

Database Name: examDB.accdb Table Name: examTab .

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

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

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

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

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

0" xmlns:xsl="http://www.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.xml <?xml version="1.PROGRAM: stud.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="stud.0" encoding="UTF-8"?> <xsl:transform version="1.xsl <?xml version="1.w3.org/1999/XSL/Transform"> .

w3.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> .org/1999/xhtml"> <head> <title>Student Details .<xsl:template match="/"> <html xmlns="http://www.

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

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

rank.0" encoding="UTF-8"?> <xsl:transform version="1.org/1999/xhtml"> <head> <title>Student Details .0" xmlns:xsl="http://www.w3.xsl <?xml version="1.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> .org/1999/XSL/Transform"> <xsl:template match="/"> <html xmlns="http://www.w3.

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

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

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

Rajasthan Royals. Karnataka.html <html> <body> <b>Full name:</b> Rahul Sharad Dravid<br/><br/> <b>Born:</b> January 11. 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. Madhya Pradesh <br/><br/> <b>Major teams:</b> India. ICC World XI. Mumbai. Marylebone Cricket Club. 1973. Bombay (now Mumbai).sachin. Indore. Mumbai Indians. Maharashtra<br/><br/> <b>Major teams:</b> India. Scotland. Legbreak googly </body></html> dravid. Kent. 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> . Asia XI. Yorkshire<br/><br/> <b>Nickname:</b> Tendlya. Asia XI. 1973.html <html> <body> <b>Full name:</b> Sachin Ramesh Tendulkar<br/><br/> <b>Born:</b> April 24.

1986. Rajasthan Cricket Association President's XI. Delhi. India Blue. 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> . Chennai Super Kings. 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> Virat Kohli<br/><br/> <b>Born:</b>November 5. India Red. Delhi<br/><br/> <b>Major teams:</b>India.</html> kohli. Uttar Pradesh. Uttar Pradesh<br/><br/> <b>Major teams:</b>India. Muradnagar. Ghaziabad.html <html> <body> <b>Full name:</b> Suresh Kumar Raina<br/><br/> <b>Born:</b>November 27. India Under19s. 1988. Indian Board President's XI. India Under-19s.

Asia XI. Delhi. Leicestershire. Chandigarh<br/><br/> <b>Major teams:</b>India. Punjab. Delhi<br/><br/> <b>Major teams:</b>India. ICC World XI. Pune Warriors. 1981.html <html> <body> <b>Full name:</b>Virender Sehwag<br/><br/> <b>Born:</b>October 20. 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.html <html> <body> <b>Full name:</b>Yuvraj Singh<br/><br/> <b>Born:</b>December 12. Asia XI. Delhi Daredevils. 1978. Kings XI Punjab. 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> . India Blue.</html> yuvi.

1981. 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> .html <html> <body bgcolor="cyan"> <b>Full name:</b> Mahendra Singh Dhoni<br/><br/> <b>Born:</b>July 7. Bihar. Ranchi. Asia XI. Chennai Super Kings. Bihar (now Jharkhand)<br/><br/> <b>Major teams:</b>India.dhoni.