IP LAB MANUAL CS2358 – INTERNET PROGRAMMING LABORATORY LABORATORY MANUAL FOR VI SEMESTER B.E / CSE ACADEMIC YEAR: 2013 – 2014 (EVEN) (FOR PRIVATE CIRCULATION ONLY) ANNA UNIVERSITY, CHENNAI. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING, THOLUDUR-606303, CUDDALORE DIST. 1 Ms.B.NIRMALA AP/CSE IP LAB MANUAL GENERAL INSTRUCTIONS FOR LABORATORY CLASSES DO’S o Without Prior permission do not enter into the Laboratory. o While entering into the LAB students should wear their ID cards. o The Students should come with proper uniform. o Students should sign in the LOGIN REGISTER before entering into the laboratory. o Students should come with observation and record note book to the laboratory. o Students should maintain silence inside the laboratory. o After completing the laboratory exercise, make sure to shutdown the system properly. DONT’S o Students bringing the bags inside the laboratory.. o Students wearing slippers/shoes insides the laboratory. o Students using the computers in an improper way. o Students scribbling on the desk and mishandling the chairs. o Students using mobile phones inside the laboratory. o Students making noise inside the laboratory. 2 Ms.B.NIRMALA AP/CSE IP LAB MANUAL HARDWARE REQUIREMENTS: Pentium IV with 2 GB RAM, 160 GB HARD Disk, Monitor 1024* 768 color 60Hz SOFTWARE REQUIREMENTS: Windows / Linux operating system Any Browser UNIVERSITY PRACTICAL EXAMINATION Allotment of marks Internal assessment Practical examination Total = 20 marks = 80 marks --------------------= 100 marks --------------------- INTERNAL ASSESSMENT (20 marks) Staff should maintain assessment register and the HOD should monitor it Split up of Internal Marks Observation Record Note Modal Exam Attendance Total = 3 marks = 7 marks = 5 marks = 5 marks --------------------= 20 marks --------------------UNIVERSITY EXAMINATION The exam will be conducted for 100 marks. Then the marks will be calculated to 80 marks Split up of Practical Examination Marks Aim and Procedure = 30 marks Program = 30 marks Execution = 20 marks Output & result = 10 marks Viva voce = 10 marks --------------------= 100 marks --------------------- Total 3 Ms.B.NIRMALA AP/CSE IP LAB MANUAL CS2358 – INTERNET PROGRAMMING LABORATORY LIST OF EXPERIMENTS 1. Web page creation 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. Web page creation with all types of Cascading style sheets 3. Client side scripts for validating web form controls using DHTML 4. Java programs to create applets i) Create a color palette with matrix of buttons ii) Set background and foreground of the control text area by selecting a color from color palette. iii) In order to select foreground or background use check box control as radio buttons. iv) To set background images. 5. Programs in java using servlets 6. Programs in java to create three-tier applications using JSP and Databases i) for conducting online examination ii) for displaying students mark list. 7. Programs using XML-schema-XSLT/XSL 8. Programs using AJAX 9. Implementation of web services and databases. 4 Ms.B.NIRMALA AP/CSE IP LAB MANUAL S. No 1. Page No CONTENTS NAME OF THE EXPERIMENTS Web page creation using HTML 6 Web page creation with all types of Cascading style 2. 11 sheets Client side scripts for validating web form controls using 3. 14 DHTML 4. Java programs to create applets 16 5. Programs in java using servlets 20 Programs in java to create three-tier Applications using 6.(a) 23 jsp and databases Student Marklist Using Servlet 28 7. Program Using Xml - Xslt 32 8. Program Using Dom With Xml 35 9. Program Using Sax With Xml 38 10. Program Using Ajax 41 11. Implementation of web services and databases. 44 12. BEYOND THE SYLLABUS Displaying time using HTML 48 13. Menus and menugroup using HTML 50 6(b) 5 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 1 Title of the exercise : WEB PAGE CREATION USING HTML Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To create a web page which includes a map and display the related information when a hot spot is clicked in the map. FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. 1 2 3 4 5 c) Details of the step Create a html file with map tag Set the source attribute of the img tag to the location of the image and also set the use map attribute Specify an area with name, shape and href set to the appropriate values Repeat step 3 as many hot spots you want to put in the map Create html files for each and every hot spots the user will select Program: ImageMap.html <HTML> <HEAD> <TITLE>Image Map</TITLE> </HEAD> <BODY><img src="india_map.jpg" usemap="#metroid" ismap="ismap" > <map name="metroid" id="metroid"> <area href='TamilNadu.html' shape='circle' coords='175,495,30' title='TamilNadu'/> <area href = "Karnataka.html" shape = "rect" coords = "100,400,150,450" title = "Karnataka" /> <area href = "AndhraPradesh.html" shape = "poly" coords = "150, 415, 175,348,265,360,190,420,190,440" title = "Andhra Pradesh" /> <area href = "Kerala.html" shape = "poly" coords = "108,455,150,515,115,490,148,495,110,448,155,501" title = "Kerala" /> </map> </BODY> </HTML> 6 Ms.B.NIRMALA AP/CSE IP LAB MANUAL TamilNadu.html <HTML> <HEAD> <TITLE>About Tamil Nadu</TITLE> </HEAD> <BODY> <CENTER><H1>Tamil Nadu</H1></CENTER> <HR> <UL> <LI>Area : 1,30,058 Sq. Kms.</LI> <LI>Capital : Chennai</LI> <LI>Language : Tamil</LI> <LI>Population : 6,21,10,839</LI> </UL><hr> <a href='ImageMap.html'>India Map</a> </BODY> </HTML> Karnataka.html <HTML> <HEAD> <TITLE>About Karnataka</TITLE> </HEAD> <BODY> <CENTER><H1>Karnataka</H1></CENTER> <HR> <UL> <LI>Area : 1,91,791 Sq. Kms</LI> <LI>Capital : Bangalore</LI> <LI>Language : Kannada</LI> <LI>Population : 5,27,33,958</LI> </UL> <hr> <a href='ImageMap.html'>India Map</a> </BODY> </HTML> AndhraPradesh.html <HTML> <HEAD> <TITLE>About Andhra Pradesh</TITLE> </HEAD> <BODY> <CENTER><H1>Andhra Pradesh</H1></CENTER> <HR> <UL> <LI>Area : 2,75,068 Sq. Kms</LI> <LI>Capital : Hyderabad</LI> <LI>Language : Telugu</LI> <LI>Population : 7,57,27,541</LI> </UL><hr> <a href='ImageMap.html'>India Map</a> 7 Ms.B.NIRMALA AP/CSE IP LAB MANUAL </BODY> </HTML> Kerala.html <HTML> <HEAD> <TITLE>About Kerala</TITLE> </HEAD> <BODY> <CENTER><H1>Kerala</H1></CENTER><HR> <UL> <LI>Area : 38,863 Sq. Kms.</LI> <LI>Capital : Thiruvananthapuram</LI> <LI>Language : Malayalam</LI> <LI>Population : 3,18,38,619</LI> </UL><hr> <a href='ImageMap.html'>India Map</a> </BODY> </HTML> d) Output: 8 Ms.B.NIRMALA AP/CSE IP LAB MANUAL 9 Ms.B.NIRMALA AP/CSE IP LAB MANUAL e) Result: Thus the creation of a web page which includes a map and display the related information when a hot spot is clicked in the map was executed successfully VIVA QUESTIONS AND ANSWERS: 1. What are the three major components of HTML document? HTML declaration The head The body 2. List out some of the HTML tags? <LI>, <DIR>, <DL>, <DT>, <DD>, <MENU>, <OL>, </UL> 3. What kind of tag is HTML? Every HTML tag is either a container tag or standalone tag. 4. How to format tags? HTML provides a host of tags that we can use to change hoe text is displayed on a browser screen. 5. Define HTML. It is a simple page description language, which enables document creation for the web. 6. List out the document structure tags. <HTML>, <HEAD>, <BASE>, <ISINDEX>, <META>, <LINK>, <SCRIPT>, <STYLR>, <TITLE>, <BDO>, and <BODY>. 10 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 2 Title of the exercise : CASCADING STYLE SHEETS Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To create a web page that displays college information using various style sheet FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step 1 Create a web page with frame sets consisting two frames 2 In the first frame include the links 3 In the second frame set display the web page of the link 4 create a external style sheets 5 create a inline and internal style sheets and make it link to the external style sheets c)Program:/ XYZ.CSS: h3{font-family:arial;font-size:20;color:cyan} table{border-color:green} td{font-size:20pt;color:magenta} HTML CODE: <html> <head><h1><center>ALL STYLE SHEETS</center></h1> <title>USE of INTERNAL and EXTERNAL STYLESHEETS </title> <link rel="stylesheet" href="xyz.css" type="text/css"> <style type="text/css"> .vid{font-family:verdana;font-style:italic;color:red;text-align:center} 11 Ms.B.NIRMALA AP/CSE IP LAB MANUAL .ani{font-family:tahoma;font-style:italic;font-size:20;text-align:center;} font{font-family:georgia;color:blue;font-size:20} ul{list-style-type:circle} </style> </head> <body> <ol style="list-style-type:lower-alpha"> <b>ARUMUGA MUDHALIYAR GROUP OF INSTITUTIONS</b><br><br><br> <li>Dr.Navalar Nedunchezhiyan college of engineering <li>Arumugham Polytechnic college <li>Arumugham arts and science <li>Arumugham teacher training </ol> <p style="font-size:20pt;color:purple">Dr.NNCE</p> <p class="ani">Arumugham Group of colleges is owned by A.Krishnaswami <br>It is approved by AICTE(All India Council for Technical Education). It is affliated to Anna University.<br></p> <h2 class="vid"> Dr.Navalar Nedunchezhiyan college of engineering </h2> <br> <font>It is an ISO certified Institution</font><br> <br> <font> <h2>List of Courses offered</h2> <ul> <li>Computer Science and Engineering</li> <li>Ece</li> <li>mech</li> <li>eee</li> </ul> </font> <h3>Results of cse students</h3> <table width="100%" cellspacing="2" cellpadding="2" border="5"> <tr> <th>S.NAME</th> <th>MARKS</th> <th>RESULT</th> </tr> <tr> <td align="center">Suppriya</td> <td align="center">100</td> <td align="center">pass</td> </tr> <tr> <td align="center">Devishree</td> <td align="center">99</td> <td align="center">pass</td> </tr> <tr> <td align="center">Vinayagam</td> <td align="center">98</td> 12 Ms.B.NIRMALA AP/CSE IP LAB MANUAL <td align="center">pass</td> </tr> </table> </body> </html> d)Output: e)Result: Thus the creation of a web page that displays college information using various style sheet was successfully executed and verified. /CDlgDlg.cpp VIVA – QUESTIONS AND ANSWERS: 1. What is CSS? CSS stands for Cascading Style Sheets. Styles define how to display HTML elements. 2. List the features of CSS? Text handling including fonts, sizing, styles and spacing. Printing specific features, downloadable fonts Support for vertical running text, multicolumn layout facilities. 3. What are the three main parts of CSS syntax? The CSS syntax is made up of three parts: a selector, a property and a value. Selector {property: value} 1. The selector is normally the HTML element/tag we wish to define. 2. The property is the attribute we wish to change and each property can take a value. 3. The property and value are sepaerated by a colon and surrounded by curly braces. 4. How to insert a style sheet? When a browser reads a style sheet, it will format the document according to it. There are three ways of inserting a style sheet: External Style Sheet Internal Style Sheet Inline styles Multiple style sheets 13 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 3 Title of the exercise : Date of the exercise : VALIDATING WEB FORM CONTROLS USING DHTML OBJECTIVE (AIM) OF THE EXPERIMENT To create a Client Side Scripts for Validating Web Form Controls using DHTML FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step 1 The form will include one text field called " Name", and a submit buton. 2 Validation script will ensure that the user enters their name before the form is sent to the server. Open this page to see it in action. 3 4 5 6 Try pressing the Send Details button without filling anything in the "Name” field. We might like to open the source code for this form in the separate window. The page consists of a JavaScript function called validate_form() that performs the form validation, followed by the form itself. c) Program: <html> <head> <title>A Simple Form with JavaScript Validation</title> <script type="text/javascript"> <!-function validate_form ( ) { valid = true; if ( document.contact_form.contact_name.value == "" ) { alert ( "Please fill in the 'Your Name' box." ); valid = false; } 14 Ms.B.NIRMALA AP/CSE IP LAB MANUAL return valid; } //--> </script> </head> <body bgcolor=”#FFFFFF”> <form name="contact_form" method="post" action="/cgi-bin/articles/development/javascript/form-validation-with-javascript/contact_simple.cgi" onSubmit="return validate_form ( );"> <h1>Please Enter Your Name</h1> <p>Your Name: <input type="text" name="contact_name"></p> <p><input type="submit" name="send" value="Send Details"></p> </form> </body> </html> d)Output: e)Result: Thus to create a Client Side Scripts for Validating Web Form Controls using DHTML was successfully executed and verified. VIVA – QUESTIONS AND ANSWERS: 1. Define: DHTML Dynamic HTML is a term used by some vendors to describe the combination of HTML, style and scripts that allow documents to be animated. 2. How to access an element in DHTML? The element must have an id attribute defined and a scripting language is needed. 3. List the DHTML document object model. Window Document Navigator Event 15 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 4 Title of the exercise : JAVA PROGRAMS TO CREATE APPLETS Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT i. ii. iii. iv. To create applets with the following features 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 checkbox controls as radio buttons. To set background images. FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step Details of the step no. 1 Import all necessary packages and classes 2 Define a class that extends applet and implements action listener and item listener 3 4 Declare an array of buttons to set colors, two checkboxes for foreground and background colors Declare a text area to hold the text, a checkbox group for checkboxes 5 Add the array of buttons in the init function 6 In the actionPerformed() method, do the following: i) Get the action command in the string, color ii) If foreground is checked then set the foreground color to the selected color iii) If background is checked then set the background color to the selected color c)Program:e import java.awt.*; import java.awt.event.*; import java.applet.*; /*<applet code="exp" width=400 height=400> </applet>*/ public class exp extends Applet implements ItemListener { 16 Ms.B.NIRMALA AP/CSE IP LAB MANUAL int currcolor=5; int flag=1; String text="Click any of the buttons"; Button buttons[]=new Button[5]; String colours[]={"Red","Blue","Green","Yellow","Magenta"}; Image img; CheckboxGroup cbg=new CheckboxGroup(); Checkbox box1=new Checkbox("Background Color",cbg,true); Checkbox box2=new Checkbox("Text Color",cbg,false); Checkbox box3=new Checkbox("Loading Image",cbg,false); u public void init() { for(int i=0;i<5;i++) { buttons[i]=new Button(" "); add(buttons[i]); } buttons[0].setBackground(Color.red); buttons[1].setBackground(Color.blue); buttons[2].setBackground(Color.green); buttons[3].setBackground(Color.yellow); buttons[4].setBackground(Color.magenta); add(box1); add(box2); add(box3); box1.addItemListener(this); box2.addItemListener(this); box3.addItemListener(this); } public void itemStateChanged(ItemEvent ev) { if(box1.getState()==true) flag=1; else if(box2.getState()==true) { text="Default color is black"; flag=2; } else if(box3.getState()==true) { img=getImage(getDocumentBase(),"Water lilies.jpg"); flag=3; } repaint(); } public void paint(Graphics g) { if(flag==2) { g.drawString(text,30,100); 17 Ms.B.NIRMALA AP/CSE IP LAB MANUAL switch(currcolor) { case 0: g.setColor(Color.red); break; case 1: g.setColor(Color.blue); break; case 2: g.setColor(Color.green); break; case 3: g.setColor(Color.yellow); break; case 4: g.setColor(Color.magenta); break; case 5: g.setColor(Color.black); break; } g.drawString(text,30,100); } else if(flag==1) { g.drawString(text,30,100); switch(currcolor) { case 0: setBackground(Color.red); break; case 1: setBackground(Color.blue); break; case 2: setBackground(Color.green); break; case 3: setBackground(Color.yellow); break; case 4: setBackground(Color.magenta); break; case 5: setBackground(Color.white); break; }} else if(flag==3) { g.drawImage(img,20,90,this); } } 18 Ms.B.NIRMALA AP/CSE IP LAB MANUAL public boolean action(Event e,Object o) { for(int i=0;i<5;i++) { if(e.target==buttons[i]) { currcolor=i; text="You have chosen "+colours[i]; repaint(); return true; } } return false; } } Doc.cpp d)Output: C:\jdk1.6.0_05\bin>javac ColorPalette.java C:\jdk1.6.0_05\bin>appletviewer ColorPalette.java e)Result: Thus the java program to create applet was successfully executed and verified. VIVA – QUESTIONS AND ANSWERS: 1. What is Applet? A Java applet is a small application written in Java and delivered to users in the form of bytecode. 2. What is servlet? The servlet is a Java programming language class used to extend the capabilities of a server 3. What do you mean by Encapsulation? Encapsulation – refers to keeping all the related members (variables and methods) together in an object. Specifying members as private can hide the variables and methods. 4. What are the benefits of the Java collection framework? Collection framework provides flexibility, performance, and robustness. 1. Polymorphic algorithms – sorting, shuffling, reversing, binary search etc. 2. Set algebra - such as finding subsets, intersections, and unions between objects. 19 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 5 Title of the exercise : PROGRAMS IN JAVA USING SERVLETS Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To write html and servlet to demonstrate invoking a servlet from a html. FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step Client: 1 2 In index.jsp on the client side declare the contents that you like to transfer to the server using html form and input type tags. create a submit button and close all the included tags. Server: 1 2 In the servlet side using the parameter request get the stings declared in the client side (requst.getparameter) Include necessary html coding that helps to display the content c)Program: Servlet Code: import java.io.*; import java.util.*; import javax.servlet.*; public class PostParam extends GenericServlet { public void service(ServletRequest request,ServletResponse response) throws ServletException,IOException { PrintWriter pw = response.getWriter(); Enumeration e = request.getParameterNames(); while(e.hasMoreElements()) { String pname = (String)e.nextElement(); pw.print(pname + " = "); String pvalue = request.getParameter(pname); 20 Ms.B.NIRMALA AP/CSE IP LAB MANUAL pw.println(pvalue); } pw.close(); } } HTML CODE: <HTML> <head> <TITLE>INVOKING SERVLET FROM HTML</TITLE> </head> <BODY> <CENTER> <FORM name = "PostParam" method = "Post" action="http://localhost:8080/servletsexamples/servlet/PostParam"> <TABLE> <tr> <td><B>Employee </B> </td> <td><input type = "textbox" name="ename" size="25" value=""></td> </tr> <tr> <td><B>Phone </B> </td> <td><input type = "textbox" name="phoneno" size="25" value=""></td> </tr> </TABLE> <INPUT type = "submit" value="Submit"> </FORM> </CENTER> </body> </html> d)Output: 21 Ms.B.NIRMALA AP/CSE IP LAB MANUAL e)Result: Thus to write html and servlet to demonstrate invoking a servlet from a html was successfully executed and verified. VIVA – QUESTIONS AND ANSWERS: 1. List out the basic Internet Protocols. TCP/IP, POP3, MIME, IMAP 2. What are Web Servers? A Web Server is software that accepts HTTP requests from web clients and returns an appropriate resource in the HTTP response. 3. Define Web Clients. A Web Client is software that accesses a web server by sending an HTTP request message and processing the resulting HTTP response. 22 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 6(a) Title of the exercise : PROGRAMS IN JAVA TO CREATE THREE-TIER APPLICATIONS USING JSP AND DATABASES Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To write java servlet programs to conduct online examination and to display student mark list available in a database FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step Client: 1 2 In index.html on the client side declare the contents that you like to transfer to the server using html form and input type tags. create a submit button and close all the included tags. Servlet: 1 Import all necessary packages 2 Define a class that extends servlet 3 In the doPost() method, do the following: i) Set the content type of the response to "text/html" ii) Create a writer to the response iii) Get a paratmeter from the request iv) If its value is equal to right answer then add 5 to mark variable v) Similarly repeat step vi) for all parameters vii) Display the result in an html format using the writer Student Mark List Database 1 Import necessary to java packages and javax packages and classes 2 Create a class that extends HttpServlet and implements ServletException and IOException In the doGet() method, do the following: i) Create a PrintWriter object ii) Open a connection with the data source name iii) Write a sql query and execute to get the resultset iv) Display the resultset information in html form 3 23 Ms.B.NIRMALA AP/CSE IP LAB MANUAL c)Program:/ SERVLET CODE: import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class StudentServlet3 extends HttpServlet { String message,Seat_no,Name,ans1,ans2,ans3,ans4,ans5; int Total=0; Connection connect; Statement stmt=null; ResultSet rs=null; public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException { try { String url="jdbc:odbc:NEO"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); connect=DriverManager.getConnection(url," "," "); message="Thank you for participating in online Exam"; } catch(ClassNotFoundException cnfex){ cnfex.printStackTrace(); } catch(SQLException sqlex){ sqlex.printStackTrace(); } catch(Exception excp){ excp.printStackTrace(); } Seat_no=request.getParameter("Seat_no"); Name=request.getParameter("Name"); ans1=request.getParameter("group1"); ans2=request.getParameter("group2"); ans3=request.getParameter("group3"); ans4=request.getParameter("group4"); ans5=request.getParameter("group5"); if(ans1.equals("True")) Total+=2; if(ans2.equals("False")) Total+=2; if(ans3.equals("True")) Total+=2; if(ans4.equals("False")) Total+=2; if(ans5.equals("False")) 24 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Total+=2; try { Statement stmt=connect.createStatement(); String query="INSERT INTO student("+"Seat_no,Name,Total"+") VALUES('"+Seat_no+"','"+Name+"','"+Total+"')"; int result=stmt.executeUpdate(query); stmt.close(); }catch(SQLException ex){ } response.setContentType("text/html"); PrintWriter out=response.getWriter(); out.println("<html>"); out.println("<head>"); out.println("</head>"); out.println("<body bgcolor=cyan>"); out.println("<center>"); out.println("<h1>"+message+"</h1>\n"); out.println("<h3>Yours results stored in our database</h3>"); out.print("<br><br>"); out.println("<b>"+"Participants and their Marks"+"</b>"); out.println("<table border=5>"); try { Statement stmt=connect.createStatement(); String query="SELECT * FROM student"; rs=stmt.executeQuery(query); out.println("<th>"+"Seat_no"+"</th>"); out.println("<th>"+"Name"+"</th>"); out.println("<th>"+"Marks"+"</th>"); while(rs.next()) { out.println("<tr>"); out.print("<td>"+rs.getInt(1)+"</td>"); out.print("<td>"+rs.getString(2)+"</td>"); out.print("<td>"+rs.getString(3)+"</td>"); out.println("</tr>"); } out.println("</table>"); } catch(SQLException ex){ } finally { try { if(rs!=null) rs.close(); if(stmt!=null) stmt.close(); if(connect!=null) 25 Ms.B.NIRMALA AP/CSE IP LAB MANUAL connect.close(); } catch(SQLException e){ } } out.println("</center>"); out.println("</body></html>"); Total=0; }} HTML CODE: <html> <head><title>Database Test</title></head> <body> <center> <h1>Online Examination</h1> </center> <form action="StudentServlet3.view" method="POST"> <div align="left"><br></div> <b>Seat Number:</b> <input type="text" name="Seat_no"> <div align="Right"> <b>Name:</b> <input type="text" name="Name" size="50"><br> </div> <br><br> <b>1. Every host implements transport layer.</b><br/> <input type="radio" name="group1" value="True">True <input type="radio" name="group1" value="False">False<br> <b>2. It is a network layer's responsibility to forward packets reliably from source to destination</b><br/> <input type="radio" name="group2" value="True">True <input type="radio" name="group2" value="False">False<br> <b>3. Packet switching is more useful in bursty traffic</b><br/> <input type="radio" name="group3" value="True">True <input type="radio" name="group3" value="False">False<br> <b>4. A phone network uses packet switching</b><br/> <input type="radio" name="group4" value="True">True <input type="radio" name="group4" value="False">False<br> <b>5. HTML is a Protocol for describing web contents</b><br/> <input type="radio" name="group5" value="True">True <input type="radio" name="group5" value="False">False<br> <br><br><br> <center> <input type="submit" value="Submit"><br><br> </center> </form> </body> </html> 26 Ms.B.NIRMALA AP/CSE IP LAB MANUAL d)Output: e)Result: Thus to write java servlet programs to conduct online examination and to display student mark list available in a database was successfully executed and verified. VIVA – QUESTIONS AND ANSWERS: 1. Define protocol. A protocol is a formal set of rules that must be followed in order to communicate. 2. What is the role of server? The server • Manages application tasks • Handles storage • Handles security • Provides scalability • Handles accounting and distribution 3. Define internet . Network is an interconnection of systems to share data and information. Internet is network of network or collection of heterogeneous networks. 27 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 6(b) Title of the exercise Date of the exercise : STUDENT MARKLIST USING SERVLET : OBJECTIVE (AIM) OF THE EXPERIMENT To create a three tier application for displaying the student marklist FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step Client: 1 2 In index.html on the client side declare the contents that you like to transfer to the server using html form and input type tags. create a submit button and close all the included tags. Servlet: 1 Import all necessary packages 2 Define a class that extends servlet 3 In the doPost() method, do the following: i)Set the content type of the response to "text/html" ii) connect with the database which has the student marklist iii) query the data to the database Display the student marklist 4 c)Program:/ SERVLET CODE: import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class serv extends HttpServlet { String message,Reg_no; Connection connect; Statement stmt=null; ResultSet rs=null; 28 Ms.B.NIRMALA AP/CSE IP LAB MANUAL public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException { try { S String url="jdbc:odbc:NEO"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); connect=DriverManager.getConnection(url," "," "); message="Mark List"; } catch(ClassNotFoundException cnfex){ cnfex.printStackTrace(); } catch(SQLException sqlex){ sqlex.printStackTrace(); } catch(Exception excp){ excp.printStackTrace(); } Reg_no=request.getParameter("regno"); response.setContentType("text/html"); PrintWriter out=response.getWriter(); out.println("<html>"); out.println("<head>"); out.println("</head>"); out.println("<body bgcolor=cyan>"); out.println("<center>"); out.println("<h1>"+message+"</h1>\n"); DI try { Statement stmt=connect.createStatement(); String query=new String("SELECT * FROM MarkList WHERE regno= "+Reg_no); rs=stmt.executeQuery(query); boolean b=rs.next(); out.println("Regsitration No:"+rs.getInt(1)); out.println("<br>"+"Name:"+rs.getString(2)); out.println("<table border=5>"); out.println("<th>"+"cs01"+"</th>"); out.println("<th>"+"cs02 "+"</th>"); out.println("<th>"+"cs03"+"</th>"); out.println("<th>"+"status"+"</th>"); while(b) { out.println("<tr>"); out.print("<td>"+rs.getString(3)+"</td>"); out.print("<td>"+rs.getString(4)+"</td>"); out.print("<td>"+rs.getString(5)+"</td>"); out.print("<td>"+rs.getString(6)+"</td>"); out.println("</tr>"); b=rs.next();} out.println("</table>"); } catch(SQLException ex){ out.println("error in connection"); } finally 29 Ms.B.NIRMALA AP/CSE IP LAB MANUAL { try { if(rs!=null) rs.close(); if(stmt!=null) stmt.close(); if(connect!=null) connect.close(); } catch(SQLException e){ } } out.println("</center>"); out.println("</body></html>"); } } HTML CODE: <html> <head><title> mark sheet</title></head> <body> <center> <h1>Student Mark Sheet</h1> </center> <form action="serv" method="POST"> registration number:<input type="text" name="regno"> <input type="submit" value="Submit"><br><br> </form> </body> </html>ializeDoc.cpp d)Output: 30 Ms.B.NIRMALA AP/CSE IP LAB MANUAL e)Result: Thus to create a three tier application for displaying the student marklist was successfully executed and verified. VIVA – QUESTIONS AND ANSWERS: 1. Define firewall. The hardware and software that sits between the Internet and the local network, checking all the data that comes and goes out is called “firewalls”. The security is provided using SSL(Secure Socket Layer) in internet. 2. What is the use of http protocol? HTTP is a standard protocol that defines how a web client talks to a server and how data is transferred from the server back to the client. HTTP relies heavily on two other standards. MIME (Multipurpose Internet Mail Extensions), HTML 3. Define port. A port is a logical channel to an application running on a host. ie., The applications running on the host machines are uniquely identified by port numbers. 31 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 7 Title of the exercise : PROGRAM USING XML - XSLT Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To implement XSLT in XML document. FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step 1 Start the program 2 Create an XML document with the details of the student such as name, address, standard and mark. 3 Import an XSL file to the xml file. 4 The XSL file imported puts the details of the students given in the xml file in a table and gets the details of each student from the xml file using the value-of attribute. The output in the browser would be the details from the XML file with 5 the style specified in XSL applied to it. 6 Stop the program. c)Program: Info.XML: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="detail.xsl"?> <student> <personal_info> <name>gokila</name> <addr>neyveli</addr> <std>3rd yr</std> <mark>98</mark> 32 Ms.B.NIRMALA AP/CSE IP LAB MANUAL </personal_info> <personal_info> <name>sivamani</name> <addr>andimadam</addr> <std>3rd yr</std> <mark>95</mark> </personal_info> <personal_info> <name>sivasangari</name> <addr>kumbakonam</addr> <std>3rd yr</std> <mark>98</mark> </personal_info> <personal_info> <name>sangeetha</name> <addr>pennadam</addr> <std>3rd yr</std> <mark>88</mark> </personal_info> </student> Detail.XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body bgcolor="pink"> <center><h2>student database</h2></center> <center> <table bgcolor="aqua" border="7" width="650" height="400"> <tr> <th>name</th> <th>addr</th> <th>std</th> <th>mark</th> </tr> <xsl:for-each select="student/personal_info"> <xsl:sort select="mark"/> <tr> <td><xsl:value-of select="name"/></td> <td><xsl:value-of select="addr"/></td> <td><xsl:value-of select="std"/></td> <td><xsl:value-of select="mark"/></td> </tr> </xsl:for-each> </table> </center> </body> </html> 33 Ms.B.NIRMALA AP/CSE IP LAB MANUAL </xsl:template> </xsl:stylesheet> d)Output: c) Result: Thus to implement XSLT in XML document was executed successfully and verified. VIVA – QUESTIONS AND ANSWERS: 1. What is the purpose of XSLT? The XSLT stands for XSL Transformations and XSL stands for eXtensible Stylesheet Language. The XSLT is used for defining the XML document transformation and presentations. 2. What is the use of XML declaration? XML declaration is a special tag used to specify the version of XML used to write the document and optionally some additional meta-information about the document such as the character set/encoding used. For e.g the syntax of XML declaration is <? XML VERSION=”1.0”?> 3. What are XML Parsers? XML Parsers are used to check whether the document is well formed and valid. 4. What are the types of XML Parsers? Validating Parsers Non-Validating Parsers 34 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Exercise Number: 8 Title of the exercise : PROGRAM USING DOM WITH XML Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To write a program using SAX along with XML file. FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step 1 Start the program 2 Keep the xml and java file in the same folder. 3 Import the required packages initially. 4 Use Buffer Reader to read the contents from the command prompt. 5 Get the name of the xml file from the user to execute. 6 Using XML Reader Factory obtain the parser. 7 If the document is correctly parsed then print document is well formed else print document is not well formed. c)Program: Parsing_DOMDemo.java: import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; public class Parsing_DOMDemo { static public void main(String[] arg) { try { 35 Ms.B.NIRMALA AP/CSE IP LAB MANUAL System.out.print("Enter the name of XML document "); BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String file_name = input.readLine(); File fp = new File(file_name); if(fp.exists()) { try{ DocumentBuilderFactory Factory_obj = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = Factory_obj.newDocumentBuilder(); InputSource ip_src = new InputSource(file_name); Document doc = builder.parse(ip_src); System.out.println(file_name + " is well-formed!"); } catch (Exception e) { System.out.println(file_name + " isn't well-formed!"); System.exit(1); }} else { System.out.print("File not found!"); }} catch(IOException ex) { ex.printStackTrace(); }}} d)Output: sax.xml: <?xml version="1.0"?> <student> <name>SHARAN</name> After Validating: sax.xml: <?xml version="1.0"?> <student> <name>SHARAN</name> </student> 36 Ms.B.NIRMALA AP/CSE IP LAB MANUAL e)Result: Thus the Linked list program was compiled and executed successfuly. VIVA – QUESTIONS AND ANSWERS: 1. What is DOM? DOM (Document Object Model) is an API that defines how JavaScript programs can access and manipulate the HTML document currently displayed by a browser. It includes the definition of the properties of document object, many of which are themselves objects with their own properties. 2. What is Node object? Every element in a document tree refers to a Node object. Some nodes of the tree are JavaScript objects corresponding to HTML elements such html or body 3. Define Thread. A thread is the Java VM’s abstract representation of the processing to be performed to accomplish a particular task, possibly concurrently with other tasks 4. List out the methods of Cookie class. Cookie, getName(), getValue(), setMaxAge() Exercise Number: 9 37 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Title of the exercise : PROGRAM USING SAX WITH XML Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To write a program using SAX along with XML file. FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step 1 Start the program 2 Keep the xml and java file in the same folder. 3 Import the required packages initially. 4 Use Buffer Reader to read the contents from the command prompt. 5 Get the name of the xml file from the user to execute. 6 Using XML Reader Factory obtain the parser. 7 If the document is correctly parsed then print document is well formed else print document is not well formed. 8 Stop the program. c)Program: import java.io.*; import org.xml.sax.*; import org.xml.sax.helpers.*; public class Parsing_SAXDemo{ public static void main(String[] args) throws IOException { try { System.out.print("Enter the name of XML document "); BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String file_name = input.readLine(); File fp = new File(file_name); 38 Ms.B.NIRMALA AP/CSE IP LAB MANUAL if (fp.exists()) { try { XMLReader reader = XMLReaderFactory.createXMLReader(); reader.parse(file_name); System.out.println(file_name + " is well-formed."); } catch (Exception e) { System.out.println(file_name + " is not well-formed."); System.exit(1);}} else { System.out.println("File is not present: " + file_name);} catch (IOException ex){ex.printStackTrace();}}} } two.xml <?xml version="1.0"?> <student> <name>SURESH</name> d)Output: XMLnot well formed program: XML well formed program: two.xml <?xml version="1.0"?> <student> 39 Ms.B.NIRMALA AP/CSE IP LAB MANUAL <name>SURESH</name> </student> e)Result: Thus to write a program using SAX along with XML file was successfully executed and verified. VIVA – QUESTIONS AND ANSWERS: 1. What is XML Namespace? An XML namespace is a collection of element and attribute names. Each namespace has a unique name that provides a means for document authors to unambiguously refer to elements with the same name in order to prevent collisions 2. What are XML Schemas? XML Schemas are part of the XML vocabulary and its addresses the standard for XML document validation by including a definition of a collection of standard data types which are used to describe data structures 3. What are the components of XSL? XSLT-XSL Transformations which defines the semantics of the various elements and attributes of the XSL namespace. XPATH – XML Path Language which defines the syntax and semantics of many of the attribute values used in XSL elements for accessing positions of the input XML XSL-FO – XSL Formatting Objects is a separate vocabulary for defining style properties of an XML document. Exercise Number: 10 40 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Title of the exercise Date of the exercise : PROGRAM USING AJAX : OBJECTIVE (AIM) OF THE EXPERIMENT To write programs to search and display chemistry element’s definition detail using JSP. FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step 1 Start the Program 2 Enter the chemistry element in index.html 3 Read the element data by request.getParameter() on chems.jsp. 4 Check given element in element list. 5 Display the definition of given element. 6 Stop the Program c)Program: Chems.html <html> <head> <script type="text/javascript"> function loadXMLDoc(){ var xmlhttp; var data = (t1.value); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest();} else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; }} 41 Ms.B.NIRMALA AP/CSE IP LAB MANUAL xmlhttp.open("GET","chems.jsp?t1="+data,true); xmlhttp.send(); } </script> </head> <body> <table> <tr><td witdh=150> Enter the Chem Name : </td> <td> <Input type=text name=t1 ></td> </tr> <tr><td witdh=150> Chem Name : </td><td> <div id="myDiv"></div></td> </tr> <tr><td> <button type="button" onClick="loadXMLDoc()">Change Content</button></td> </tr> </table> </body> </html> chems.jsp <% String d=request.getParameter("t1"); String[]name; int i=0,n=0; name=new String[10]; name[0]="atomic number"; name[1]="catalyst"; name[2]="acid"; name[3]="base"; name[4]="bond energy"; name[5]="chain reactons"; name[6]="covalent bonds"; name[7]="element"; name[8]="enzyme"; name[9]="kinetics"; String[] defn; defn=new String[10]; defn[0]="It is defined as the number of protons or electrons."; defn[1]="a catalyst is a substance which fastens a reaction without themselves undergoing any change."; defn[2]="An agent able to produce positively charged hydrogen ions."; defn[3]="A base is a substance that can combine with a proton."; defn[4]="The energy required to break a particular bond by hompolytic process."; defn[5]="chain reaction:reactions which proceed by means of a set of repeating cyclic steps."; 42 Ms.B.NIRMALA AP/CSE IP LAB MANUAL defn[6]="Linkage of two atoms by the sharing of two electrons."; defn[7]="a substance which cannot be further subdivided by chemical methods."; defn[8]="a naturally occuringb substance able to catalyse a chemical reaction."; defn[9]="The study of rate of reactions."; for(i=0;i<9;i++) { if(d.equals(name[i])) n=i; } out.println(defn[n]); %> d)Output: e)Result: Thus to write programs to search and display chemistry element’s definition detail using JSP. VIVA – QUESTIONS AND ANSWERS: 1. What is the concept behind JAX-RPC technology? The Web services are the software systems that are displayed by the web browser using the web protocol. These software systems are used by the some of the application rather than by end-users directly. 2. What is XSL and why it is used. The Extensible Stylesheet Language (XSL) is an XML vocabulary typically used to transform XML document from one form to another form. XSL document are well-formed XML documents. 3. What is meant by WSDL? WSDL is Web Services Definition Language which is based on XML. WSDL defines the web service like operation, parameter, return values and communication protocols. Exercise Number: 11 Title of the exercise : Date of the exercise : WEB SERVICE-DATABASE CONNECTIVITY 43 Ms.B.NIRMALA AP/CSE IP LAB MANUAL OBJECTIVE (AIM) OF THE EXPERIMENT To implement a program to run the web service. FACILITIES REQUIRED AND PROCEDURE a) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any Browser b) Procedure: Step no. Details of the step 1 Start the Program 2 Create a new service web application as server in net beans 3 4 In the server side web application, save the NewWebService program in java extension. In the web service side name the pack as pack1 5 Clean and build the server side and then text the web service 6 Create the client side as web application client and save the programs in jsp and html extension 7 Clean and build the server side and then text the web service client 8 Stop the Program c)Program: NewWebService.java: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package pack1; import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.WebParam; import java.sql.*; /** * * @author SREC */ @WebService() public class NewWebService { 44 Ms.B.NIRMALA AP/CSE IP LAB MANUAL @WebMethod (operationName="get") public String[] get(@WebParam(name="from")String from,@WebParam (name="to")String to) { String hello[]=new String[6]; int i=0; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String filename = "d:/data1.mdb"; String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="; database+= filename.trim() + ";DriverID=22;READONLY=true}"; Connection con = DriverManager.getConnection( database ,"",""); Statement s = con.createStatement(); s.execute("select * from details "); ResultSet rs = s.getResultSet(); if (rs != null) while ( rs.next() ) { hello[i]= rs.getString("name"); i++; hello[i]= rs.getString("date"); i++; }} catch (Exception e) { System.out.println("Error: " + e); } return hello; }} Index.jsp: <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>Hello World!</h1> <form name="air" action="action.jsp" method="post"> From<input type="text" name="from" id="from"><br/> To<input type="text" name="to" id="to"><br/> <input type="submit" value="GetDtails"> </form> </body> </html> Action.jsp: <%@page contentType="text/html" pageEncoding="UTF-8"%> 45 Ms.B.NIRMALA AP/CSE IP LAB MANUAL <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>Hello World!</h1> <% String from1=request.getParameter("from"); String to1=request.getParameter("to"); %> <%-- start web service invocation --%><hr/> <% try { pack1.NewWebServiceService service = new pack1.NewWebServiceService(); pack1.NewWebService port = service.getNewWebServicePort(); // TODO initialize WS operation arguments here java.lang.String from = from1; java.lang.String to = to1; // TODO process result here java.util.List<java.lang.String> result = port.get(from, to); out.println("Result = "+result); } catch (Exception ex) { // TODO handle custom exceptions here } %> <%-- end web service invocation --%><hr/> </body> </html> d)Output: 46 Ms.B.NIRMALA AP/CSE IP LAB MANUAL From To vellore katpadi e)Result: Thus to implement a program to run the web service was successfully executed and verified. VIVA – QUESTIONS AND ANSWERS: 1. What are Web Services? Web Services are software systems that are designed to be accessed using web protocols and technologies that are intended to be used by other software applications rather than directly by end users. 2. Define the term RPC. Remote Procedure Call is the generic term used for the type of communication used to describe web service operations when the client makes a call to a method or procedure that resides on another machine (remotely) 3. List out the default ports of Tomcat Web Server and Java Web Server Tomcat – 8080 JWS – 9090 HTTP – 80 SMTP – 25 Telnet – 23 POP3 – 110 4. List out the objects used for database access using JDBC. Connection Statement ResultSet Exercise Number: 12 47 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Title of the exercise : DISPLAYING TIME USING HTML Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To display the time with hours, minutes and seconds using HTML FACILITIES REQUIRED AND PROCEDURE c) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any browser d) Procedure: Step no. Details of the step 1 Start the program. 2 Create a HTML file content for displaying time 3 Use javascript for diplaying hours,minutes and seconds. 4 Write the document 5 Display the output with hours, minutes and seconds. 6 Stop the program c)Program: <html> <body> <script type="text/javascript"> var d=new Date() document.write(d.getUTCHours()) document.write(".") document.write(d.getUTCMinutes()) document.write(".") document.write(d.getUTCSeconds()) </script> </body> </html> d)Output: 4.57.8 48 Ms.B.NIRMALA AP/CSE IP LAB MANUAL e)Result: Thus to display the time with hours, minutes and seconds using HTML was executed successfully and verified. VIVA QUESTIONS AND ANSWERS: 1. What are the necessities of using HTML forms? Gathering user information Conducting surveys Interactive services 2. What is a protocol? An agreed-upon format for transmitting data between two devices. 3. List out the frame tags. <IMG>, <MAP>, and <AREA> 4. List out the frame tags. <FRAMESET>, <FRAME>, <NOFRAMES>, and <IFRAME>. Exercise Number: 13 49 Ms.B.NIRMALA AP/CSE IP LAB MANUAL Title of the exercise : MENUS AND MENU GROUPING Date of the exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To create menus and menu grouping using HTML FACILITIES REQUIRED AND PROCEDURE e) Facilities Required: S.No. Facilities required Quantity 1 System 1 2 O/S Windows / Linux OS 3 S/W name Any browser f) Procedure: Step no. Details of the step 1 Start the program. 2 Create a HTML file content for creating menus and menu group 3 Use javascript to display the group of elements 4 Use option command for selection 5 Display the output with menus and menu groups 6 Stop the program c)Program: Menus.Html <html> <body> <select> <option>volvo</option> <option>saab</option> <option>mercedes</option> <option>audi</option> </select> </body> </html> Menugroup.html <html> <body> <select> <optgroup label="swedish cars"> <option value="volvo">volvo</option> <option value="saab">saab</option> <optgroup> <optgroup label="German cars"> <option value="mercedes">mercedes</option> 50 Ms.B.NIRMALA AP/CSE IP LAB MANUAL <option values="audi">audi</option> </optgroup> </select> </body> </html> d)Output: e)Result: Thus to create menus and menu grouping using HTML was successfully executed and verified. VIVA QUESTIONS AND ANSWERS: 1. What is javascript? Javascript is case sensitive and also it is used on client side mainly for checking form validations. 2. Differentiate between java and java script. The main difference is that java is a platform independent language; whereas javascript is a computer programming/scripting language that does not refer to how the scripts are executed. 3. Write down the DHTML syntax for binding an image to the data and sort the data on the data source. <img datasrc=”#Images” datafld=”image” alt=”Image” Style=”position: relative;left:45px”/><br/> 51 Ms.B.NIRMALA AP/CSE IP LAB MANUAL CS2358 – INTERNET PROGRAMMING LABORATORY MODEL QUESTION SET 1. Create a Web page using HTML with the following 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. Create a Web page with all types of Cascading style sheets 3. Create a Client side scripts for validating web form controls using DHTML 4. Create Java programs using applets with the following requirements 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. 5. Create Programs in java using servlets 6. Create Programs in java to create three-tier applications using JSP and Databases for conducting online examination for displaying students mark list. 7. Create Programs using XML-schema-XSLT/XSL 8. Create Programs using AJAX 9. Implementation of web services and databases. 52 Ms.B.NIRMALA AP/CSE
© Copyright 2024