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

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. for conducting on-line examination. Assume that student information is available in a database which has been stored in a database server.for displaying student mark list.14 10 Implement this scenario using Web Services and Data base.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. 15 Model Examination 150m .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. b. 150m 13.10 7 a.an airline service and a travel agent and the travel agent is searching for an airline.

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

...</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. from Sanskrit</li> </ul> <p> <font size="4" face="Calibri"color="red"> Click On The Hotspots To View More Information About That Particular Places. which is derived from the Old Persian word Hindu. 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 <html> <head> <title>Image Mapping. </font> </p> <map name="indiamap"> .PROGRAM: india.

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

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

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

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

html">Home</a> </font> </body> </html> .8 °C (80. formerly known as Calcutta.jpg"><br> <font face="Cambria" color="blue" size="3">Victoria Memorial</td> <td> <font face="Cambria" color="blue" size="2"> <ul> <li>Kolkata.2 °F)</li> </ul> </td> </tr> </table> <font face="Cambria" color="blue" size="2"> <a href="india.<tr> <td><img src="VictoriaMemorial. is the capital of the Indian state of West Bengal</li> <li>Before 1690 Kolkata. 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.

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

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

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

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

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

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

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

<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.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....E <input type="checkbox" name="chk">M...!</h3> </body> </html> .

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

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

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

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

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

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

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

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

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

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

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

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

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.jsp"> 1.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/> .PROGRAM: ExamClient.font-family:courier.

font-family:courier.*"%> <html> <head> <title>Online Exam Server</title> <style type="text/css"> body{background-color:black.sql.3.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.jsp <%@page contentType="text/html" language="java" import="java.

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

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

Database Name: examDB.accdb Table Name: examTab .

html) with the following Create a form to get the input (Register Number) from the user. 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. .  Displays the mark list to the client as the response.   Design the HTML page (stud. 2.  Retrieves the details from the database table with respect to the form input. ALGORITHM: 1.  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().

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

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

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

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

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

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

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

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

ALGORITHM: 1. Chrome.  Create the object for ActiveXObject (for older versions of browsers such as IE5 and IE6). Safari. .  Create the object for XMLHttpRequest (for modern browsers such as IE7+.   Create an XHTML document (AjaxDemo.   Receive the response with the use of responseText Property.html) with the following. and Opera). insert AJAX based JavaScript code with the following.  AJAX send the request with the use of send() and open() methods.  Call the function clearContent() with respect to the onmouseout event. Insert some images of cricket players. 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. Within this XHTML document. AJAX Call the function diplayProfile() with respect to the event onreadystatechange. Call the function getContent() with respect to the onmouseover event. Firefox. 2.

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

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

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

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

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

Bihar. Ranchi. Bihar (now Jharkhand)<br/><br/> <b>Major teams:</b>India. 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. 1981. Chennai Super Kings.dhoni. Asia XI.