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

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

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

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

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

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

.html <html> <Title>Delhi.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..25 million people.0 °F)</li> </ul> </td> </tr> </table> <font face="Cambria" color="blue" size="2"> <a href="india. 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...html">Home</a> </font> </body> </html> delhi.<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.</font></p> <table> <tr> .

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

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

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

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

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

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

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

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

chk[1].alert("Plz Select Your Country"). return false.checked==f alse)) { window. } else if((document. } else return true.else if(document.chk[0].f1.checked==false)&&(document.alert("Plz Select Your Qualification"). return false. return false.f1.alert("Plz Choose Your Gender"). } else if((document.selectedIndex==0) { window.country.html" onsubmit="return validation()"> <fieldset> <legend>Registration Form</legend> .rdo[1].rdo[0].f1.checked==f alse)) { window.f1.f1.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.

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

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

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

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

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

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

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

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

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

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

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

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

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

ALGORITHM: 1. Set the URL of the server (ExamServer. .jsp) as the value of the action attribute.    Create the JSP file with the following Read the input from the client.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.  Use submit button to invoke the server and send the form data to the server.html) with the following Create a form to get the input from the user.   For each correct answer increment the mark by 5. Server displays the mark and result to the client as a response. Match the answers with the correct answers are available inthe database table. Use radio buttons to make various options for the questions. 2.    Design the HTML page (ExamClient.

PROGRAM: ExamClient.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.html <html> <head> <title>Online Exam Client</title> <style type="text/css"> body{background-color:black.font-family:courier.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/> .

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

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

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

Database Name: examDB.accdb Table Name: examTab .

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

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

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

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

.xml) in the browser. and <rno>. Create an XSL document (stud. 2. <dept>. Create an XML document (stud.xml) that contains the markup tags such as <name>. 3. Load the XML document (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. ALGORITHM: 1. Associate style sheet (XSL) with XML using the markup <?xml- stylesheet> 4.

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

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

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

<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> .S.C.Kohli</name> <country>IND</country> </player> <player> <rank>4</rank> <name>K.

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

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

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

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

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

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

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

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