CS8651 Internet Programming Copy
CS8651 Internet Programming Copy
1
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
2
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
OUTCOMES:
At the end of the course, the students should be able to:
Construct a basic website using HTML and Cascading Style Sheets.
Build dynamic web page with validation using Java Script objects and by applying different
event handling mechanisms.
Develop server side programs using Servlets and JSP.
Develop server side programs using JSP.
Construct simple web pages in PHP and to represent data in XML format.
Use AJAX and web services to develop interactive web applications
TEXT BOOK:
1. Deitel and Deitel and Nieto, ―Internet and World Wide Web – How to Program‖, Prentice
Hall, 5th Edition, 2011.
REFERENCES:
1. Stephen Wynkoop and John Burke ―Running a Perfect Website‖, QUE, 2nd Edition,1999.
2. Chris Bates, Web Programming – Building Intranet Applications, 3rd Edition, Wiley
Publications, 2009.
3. Jeffrey C and Jackson, ―Web Technologies A Computer Science Perspective‖, Pearson
Education, 2011.
4. Gopalan N.P. and Akilandeswari J., ―Web Technology‖, Prentice Hall of India, 2011.
5. UttamK.Roy, ―Web Technologies‖, Oxford University Press, 2011.
TOTAL: 45 PERIODS
COURSE OUTCOME
CO1 Construct a basic website using HTML and Cascading Style Sheets.
Build dynamic web page with validation using Java Script objects and by applying different
CO2
event handling mechanisms.
CO3 Develop server side programs using Servlets and JSP.
CO4 Develop server side programs using JSP.
CO5 Construct simple web pages in PHP and to represent data in XML format.
CO6 Use AJAX and web services to develop interactive web applications
3
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
UNIT I WEBSITE BASICS, HTML 5, CSS 3, WEB 2.0
Web Essentials: Clients, Servers and Communication – The Internet – Basic Internet protocols –
World wide web – HTTP Request Message – HTTP Response Message – Web Clients – Web
Servers – HTML5 – Tables – Lists – Image – HTML5 control elements – Semantic elements –
Drag and Drop – Audio – Video controls – CSS3 – Inline, embedded and external style sheets –
Rule cascading – Inheritance – Backgrounds – Border Images – Colors – Shadows – Text –
Transformations – Transitions – Animations.
PART – A
5. Define Internet.(R)
Internet is the network of networks connected via the public backbone and communicating
using TCP/IP communication protocol. Internet is a network of interconnected computers that is
now global.
10. List any four common browsers. (R) (NOV / DEC 2011)
(i) Internet Explorer
(ii) Mozilla Firefox
(iii) Opera
5
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
(iv) Google Chrome
12. Define Protocol and list various types of protocols. (R) (MAY/JUNE 2013)
Protocol is a set of rules and regulations which should be obeyed by both sender and
receiver for data communication.
TCP/IP - Transmission Control Protocol/Internet Protocol – Connection Oriented
Protocol
HTTP – Hypertext Transfer Protocol – Connection Oriented Protocol
FTP – File Transfer Protocol - Connection Oriented Protocol
POP3 – Post Office Protocol – Connection Oriented Protocol
SMTP – Simple Mail Transfer Protocol –
Telnet Protocol – Used in Remote Login System
UDP – User Datagram Protocol- Connectionless Protocol
Note: POP3 and SMTP protocols are used only in email-generation.
6
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
WWW contains huge amount of documents, images and other resources which can be
accessed using the hyperlinks. Thus the internet can be used through the web.
A relative URL locates a resource using an absolute URL as a starting point. In effect, the
"complete URL" of the target is specified by concatenating the absolute and relative URLs. A
relative URL typically consists only of the path, and optionally, the resource, but no scheme or
server i.e. Relative URLs are a way to identify a resource relative to their context.
Example:
Relative URL Absolute URL
d/e.html http://www.example.org/a/b/d/e.html
Request Line
The first line of the header is called the request line, followed by optional request headers.
The request line has the following syntax:
request-method-name request-URI HTTP-version
request-method-name: HTTP protocol defines a set of request methods, e.g., GET, POST,
HEAD,and OPTIONS. The client can use one of these methods to send a request to the
server.
request-URI: specifies the resource requested.
8
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
HTTP-version: Two versions are currently in use: HTTP/1.0 and HTTP/1.1.
Request Headers
The request headers are in the form of name:value pairs. Multiple values, separated by commas, can
be specified.
request-header-name: request-header-value1, request-header-value2, ...
Status Line
The first line is called the status line, followed by optional response header(s).
The status line has the following syntax:
HTTP-version status-code reason-phrase
HTTP-version: The HTTP version used in this session. Either HTTP/1.0 and HTTP/1.1.
status-code: a 3-digit number generated by the server to reflect the outcome of the request.
reason-phrase: gives a short explanation to the status code.
Common status code and reason phrase are "200 OK", "404 Not Found", "403 Forbidden",
"500 Internal Server Error".
9
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Response Headers
The response headers are in the form name:value pairs:
response-header-name: response-header-value1, response-header-value2, ...
10
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
33. What is the use of Drag and drop property in HTML5? (U)
Drag and Drop (DnD) is powerful User Interface concept which makes it easy to copy, reorder
and deletion of items with the help of mouse clicks. This allows the user to click and hold the
mouse button down over an element, drag it to another location, and release the mouse button
to drop the element there.
11
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
HTML XHTML
XHTML (Extensible HyperText
HTML or HyperText Markup Markup Language) is a family of
Language is the main markup XML markup languages that
Introduction language for creating web pages mirror or extend versions of the
and other information that can be widely used Hypertext Markup
displayed in a web browser. Language (HTML), the language in
which web pages are written.
Filename extension .html, .htm .xhtml, .xht, .xml, .html, .htm
Internet media type text/html application/xhtml+xml
Developed by W3C & WHATWG World Wide Web Consortium
Type of format Document file format Markup language
Extended from SGML XML, HTML
Extensible HyperText Markup
Stands for HyperText Markup Language
Language
Application of Standard
Application Application of XML
Generalized Markup Language
13
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
(SGML).
Extended version of HTML that is
Function Web pages are written in HTML.
stricter and XML-based.
Restrictive subset of XML and
Flexible framework requiring
Nature needs to be parsed with standard
lenient HTML specific parser.
XML parsers.
Proposed by Tim Berners-Lee in World Wide Web Consortium
Origin
1987. Recommendation in 2000.
HTML 2, HTML 3.2, HTML 4.0, XHTML 1, XHTML 1.1, XHTML
Versions
HTML 5. 2, XHTML 5.
39. Mention the need for Cascading Style Sheets. (U) (APRIL/ MAY 2011)
Give some advantages of using CSS. (NOV/DEC 2013)
(1) CSS allows the separation between the information contained in a document and its
presentation.
(2) Any change in the presentation can be made without disturbing the information of the
document.
(3) CSS allows developers to give the consistent appearance to all elements of the web page.
40. Give the syntax of a CSS rule. (R) (NOV/DEC 2011, MAY/JUNE 2012)
A CSS style sheet consists of one or more style rules called rulesets.
Each rule set consists of two parts:
1 Selector string
2 Declaration block
declarations
Property names
P{ font-size : x-large
Background-color : yellow
Selector String
Declaration block
14
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
41. What is Selector Strings? Explain its types.(U)
The selector string indicates the elements to which the rule should apply, and each
declaration within the declaration block specifies a value for one style property of those
elements.
44. List the different <style> tag color and background attributes. (R)
Attributes Values
Color Sets an element‟s text-color- a color name or a color code
Background- Specifies the color in an element‟s background. A color name or a color code.
color
Background- Sets the background image. A URL or none.
image
Background- Within the background image specified, sets up how the image repeats
repeat throughout the page. Repeat-x (repeats horizontally), repeat-y(repeats
vertically), repeat(both), no-repeat.
16
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
47. List the different <style> tag Margin attributes.(R)
Attributes Values
Margin-top Percent, length or auto
Margin-bottom Percent, length or auto
Margin-left Percent, length or auto
Margin-right Percent, length or auto
Margin Percent, length or auto
49. List out some of the new properties added in CSS3. (R)
Following is a list of CSS properties that were not defined in the CSS2.1 specification.
animation
background-clip
background-origin
background-size
border-radius
border-image
box-decoration-break
box-shadow
box-sizing
columns
clear-after
flex
font-stretch
font-size-adjust
font-synthesis
font-kerning
font-variant-caps
hanging-punctuation
hyphens
icon
image-resolution
17
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
image-orientation
line-break
object-fit
object-position
opacity
outline-offset
overflow-wrap / word-wrap
backface-visibility
perspective
perspective-origin
pointer-events (for HTML)
resize
tab-size
text-align-last
text-decoration-line
text-decoration-skip
text-decoration-position
text-decoration-style
text-emphasis
text-justify
text-orientation
text-overflow
transform
transform-style
text-shadow
transition
word-break
word-spacing
writing-mode
50. How does a Rich Internet Application (RIA) differ from a traditional web application?
(AN) (MAY/JUNE 2016)
Features Web applications RIAs
Rich User Experience N Y
Interactive, Responsive N Y
Low Maintenance Y Y
51. Write appropriate inline CSS to show a section of the HTML document with a font size of
20. (AP) (MAY/JUNE 2016)
An inline CSS is used to apply a unique style to a single HTML element.
An inline CSS uses the style attribute of an HTML element.
18
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
<!DOCTYPE html>
<html>
<head>
<title>HTML Inline CSS</title>
</head>
<body>
<p style="font-size:20px;">This is thick</p>
</body>
</html>
52. List out some of the shadow effects added in CSS3. (R)
CSS is used to add shadow to text and to elements. It has following properties:
text-shadow
box-shadow
CSS Text Shadow
The CSS text-shadow property applies shadow to text.
In its simplest use, only specify the horizontal shadow (2px) and the vertical shadow (2px). To
add more than one shadow to the text, you can add a comma-separated list of shadows.
53. List out some of the border images added in CSS3. (R)
CSS Border image property is used to add image border to some elements. A sample syntax of
boarder image is as follows –
#borderimg {
border: 10px solid transparent;
padding: 15px;
}
The most commonly used values are shown below –
border-image-source - Used to set the image path
border-image-slice - Used to slice the boarder image
border-image-width - Used to set the boarder image width
border-image-repeat - Used to set the boarder image as rounded, repeated and stretched
19
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
It is used to add transition effect for more than one CSS property. If you want to add transition
effect on more than one property, separate those properties with a comma.
58. Give an example for inline style sheet. (R) (NOV/DEC 2018)
An inline style may be used to apply a unique style for a single element. To use inline styles,
add the style attribute to the relevant element. The style attribute can contain any CSS property.
Example
Inline styles are defined within the "style" attribute of the relevant element:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
60. What is Web 2.0 and give its example? (R) (APRIL/MAY 2021)
A Web 2.0 website allows users to interact and collaborate with each other through social media
dialogue as creators of user-generated content in a virtual community. This contrasts the first
generation of Web 1.0-era websites where people were limited to viewing content in a passive
manner.
Examples of Web 2.0 features include social networking sites or social media sites (e.g.,
Facebook), blogs, wikis, folksonomies ("tagging" keywords on websites and links), video
sharing sites (e.g., YouTube), image sharing sites (e.g., Flickr), hosted services, Web
applications ("apps"), collaborative consumption platforms, and mashup applications.
21
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
PART – B
22
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
UNIT – II CLIENT SIDE PROGRAMMING
PART – A
4. Write a JavaScript program to display “welcome” message on the browser window. (C)
<!DOCTYPE html>
<html>
<head>
<title>This is a JavaScript example</title>
<script language="JavaScript">
document.write("Hello World!");
</script>
</head>
<body> Hello, User! </body>
</html>
23
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
5. Write a JavaScript program to display “welcome” message in the alert box. (C)
<!DOCTYPE html>
<html>
<head>
<title>This is a JavaScript example</title>
<script language="JavaScript">
Window.alert("Hello World!");
</script>
</head>
<body> Hello, User! </body>
</html>
6. Give the syntax to get input from the user in JavaScript. (R)
Prompt dialog - which allows the user to input a value that the script can use.
Syntax:
Variable = window.prompt(“message to be displayed”,”default value”);
Example:
var name = window.prompt(“Please Enter your name:”,”XXX”);
7. List out the java script built in Objects. (R) (MAY / JUNE 2012)
The global Object (window)
String
Number
Boolean
Date
Math
Array
11. What is meant by intrinsic event handling? (U) (MAY / JUNE 2012)
Intrinsic event handling is a mechanism to attach specific scripts to your documents that
are executed only when something happens to an element.
event - an action performed by the user, browser, or script
event handler - JavaScript statements that execute when the event occurs
• An event is an occurrence of something potentially interesting to a script:
– Ex: mouseover and mouseout events
12. List some Intrinsic Event Attributes. (R) (APRIL/MAY 2011, NOV/DEC 2013)
Attribute When Called
Onload The body of the document has just been fully read and parsed by the browser
(this attribute pertains only do body and frameset)
Onunload The browser is ready to load a new document in place of the current document
(this attribute only pertains to body and frameset)
Onclick The mouse button has been clicked and released over the element
ondblclick The mouse button has been double clicked and released over the element
onmousedown The mouse has been clicked over the element
onmouseup The mouse has been released over the element
onmouseover The mouse has just moved over the element
onmousemove The mouse has moved from one location to another over the element
onmouseout The element has just moved away from the element.
Onfocus The element has just to receive the keyboard focus (attribute pertains only to
certain element including a label.input, select, text area and button)
Onblur The element has just lost the keyboard focus (attribute pertain only to the same
25
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
element as on focus
onkeypress This element has the focus and a key has been present and released
onkeydown This element has the focus and a key has been pressed and released
Onkeyup This element has the focus and a key has been released.
Onsubmit This element is ready to be submitted (applies only to form elements)
Onreset This element is ready to be reset (applies only to form elements)
onselelect Text in this element has been selected (highlighted) in preparation for editing
(applies only to input and text area element)
Onchange The value of this element has changed (applies only to input, text area and select
elements)
26
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
6. Interoperability
27
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
PART – B
1. Whether JavaScript a statically types or dynamically typed language. Justify your answer
with examples. (AN) (APRIL/MAY 2022)
2. Write a JavaScript program to add two integers. Get the input from the user and display the
result in pop-up box. (C)
3. Explain about DOM Nodes and Tress. (U)
4. Write JavaScript to find sum of first n even numbers and display the result. Get the value of
„n‟ from user. (C) (MAY/JUNE 2013)
5. Write JavaScript to find factorial of a given number. (C)
6. Describe how do you use regular expression on java script for form validation? Develop a
complete application that would include functions to validate the user data. (C)
(MAY/JUNE2014)
7. Explain in detail about how the exceptions can be handled in JavaScript. (U)
8. Explain about java script Built-in Objects. (U) (MAY / JUNE 2014)
9. Explain DOM Model and its properties. (U) (NOV/DEC 2015, APRIL/MAY 2022)
10. Explain Document Tree with an example. (U) (MAY/JUNE 2011, MAY/JUNE 2012)
11. Explain the DOM Event handling with suitable example. (U)
(MAY/JUNE 2011, NOV/DEC 2011, MAY/JUNE 2012)
12. Use JavaScript and HTML to create a page with two panes. The first pane (on the left)
should have a text area where HTML code can be typed by the user. The pane on the right
side should display the preview of the HTML code typed by the user, as it would be seen on
the browser. (C) (MAY/JUNE 2016)
13. Write a DHTML program to handle the user click event. (C) (NOV/DEC 2016)
14. Explain any two validation functions in Java script. (U) (NOV/DEC 2018)
15. Write a Java script program to print prime numbers from 1 to 100. (U) (NOV/DEC 2018)
16. Explain the concept of JSON with an example. (U) (NOV/DEC 2018)
17. What is the significance and what are the benefits of including „Use strict‟ at the beginning
of a JavaScript source file? (U) (APRIL/MAY 2021)
18. Demonstrate use of JSON. How to convert JavaScript objects to JSON ? List the benefits of
JSON over XML. (A) (APRIL/MAY 2021)
28
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Servlets: Java Servlet Architecture- Servlet Life Cycle- Form GET and POST actions- Session
Handling- Understanding Cookies- Installing and Configuring Apache Tomcat Web Server-
DATABASE CONNECTIVITY: JDBC perspectives, JDBC program example – JSP:
Understanding Java Server Pages-JSP Standard Tag Library (JSTL)-Creating HTML forms by
embedding JSP code.
PART - A
1. What is a Servlet? (R)
Servlet is a server side programming language which is used for generating dynamic web
pages. It generates web-page as a response of the request received from client (browser).
30
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
10. What are the common HTTP request methods used for request-response between
browser and server? (U)
Method Description
GET Requests data from a specified resource
POST Submits data to be processed to a specified resource
HEAD Same as GET but returns only HTTP headers and no document body
PUT Uploads a representation of the specified URI
DELETE Deletes the specified resource
OPTIONS Returns the HTTP methods that the server supports
CONNECT Converts the request connection to a transparent TCP/IP tunnel
31
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
12. What is ServletConfig? (R)
ServletConfig interface belongs to the package javax.servlet.ServletConfig. It is used for
passing the configuration parameters to the servlet. Servlet container instantiate it implicitly.
15. What is meant by Session Tracking or Session Handling? (U) (APRIL/MAY 2021, 2022)
Session Tracking is the capability of a server to maintain the current state of a single
client‟s sequential requests. Using session tracking, we can keep track of previous session
(conversations) held between server and the browser by using session ID.
17. What are the different techniques used for handling sessions? (R)
Cookies
Hidden Form Field
URL Rewriting
HttpSession
18. What are cookies? Give its uses. (U) (NOV/DEC 2015)
A Cookie is a name-value pair of information that a web server sends to a client machine as
a part of an HTTP response. The bowser then returns the cookie unchanged to the server to
indicate the state of the conversation.
In URL rewriting, a token(parameter) is added at the end of the URL. The token consist of
name/value pair seperated by an equal(=) sign.
33
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
20. List out the steps to connect a Java application with DB.(R)
There are 5 steps to connect any java application with the database in java using JDBC.
They are as follows:
1. Register the driver class
2. Creating connection
3. Creating statement
4. Executing queries
5. Closing connection
34
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
1. Extension to Servlet: JSP technology is the extension to servlet technology. We can use all
the features of servlet in JSP
2. Dynamic contents can be handled using JSP because JSP allows scripting and element based
programming.
3. JSP is useful for server side programming.
4. JSP programming is easy to learn and easy to implement.
5. JSP programming environment provides the separation between presentation logic and
business logic.
6. JSP provides optional mechanism in configuring web application file (web.xml).
7. JSP allows creating and using our own custom tag libraries. Hence any application specific
Requirements can be satisfied using custom tag libraries. This helps the developer to
develop any kind of application.
8. Fast Development: No need to recompile and redeploy If JSP page is modified, we don't
need to recompile and redeploy the project.
35
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
In JSP, both presentation layer and business logic Both presentation layer and business logic
9.
layer can be separated with the usage of JavaBeans. layer put together in Servlets
Writing alias name in <url-pattern> tag of web.xml Writing alias name in <url-pattern> tag of
10.
is optional in JSP. web.xml is mandatory in Servlets
Navigate to the node to be removed then use parentNode property and removeChild
()
36
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
<html>
<head><script src="loadxmldoc.js"> </script></head>
<body><script>
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book")[0];
x.parentNode.removeChild(x);
</script></body>
</html>
29. Write the code segment to store current server time in session using java servlet
API. (C) MAY/JUNE 2016)
boolean result;
try {
session.getCreationTime();
result = false;
} catch (IllegalStateException ise) {
result = true;
}
if (result) {
pw.print("PASS");
} else {
pw.print("FAIL");
}
}
32. List any four methods of Date object. (R) (NOV/DEC 2016)
The Date object is a datatype built into the JavaScript language.
Method Description
Date() Returns today's date and time
getDate() Returns the day of the month for the specified date according to
37
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
local time.
Returns the day of the week for the specified date according to
getDay()
local time.
getFullYear() Returns the year of the specified date according to local time.
33. Explain the servlet interface and its methods. (U) (NOV/DEC 2016)
Servlet interface provides common behaviour to all the servlets.Servlet interface needs to be
implemented for creating any servlet (either directly or indirectly). It provides 3 life cycle
methods that are used to initialize the servlet, to service the requests, and to destroy the servlet
and 2 non-life cycle methods.
Methods of Servlet interface
There are 5 methods in Servlet interface. The init, service and destroy are the life cycle methods
of servlet. These are invoked by the web container.
Method Description
initializes the servlet. It is the life cycle method of
public void init(ServletConfig config) servlet and invoked by the web container only
once.
public void service(ServletRequest provides response for the incoming request. It is
request,ServletResponse response) invoked at each request by the web container.
is invoked only once and indicates that servlet is
public void destroy()
being destroyed.
public ServletConfig getServletConfig() returns the object of ServletConfig.
returns information about servlet such as writer,
public String getServletInfo()
copyright, version etc.
PART B
1. What are the different phases of Java Servlet Life Cycle? Illustrate the different functionalities of
servlet container. (U) (APRIL/MAY 2021)
2. Discuss about the architecture and life cycle of a servlet with example.
Explain Single-Threaded Model in Servlets. How does Servlets Collaboration take place? (U)
(NOV/DEC 2012, MAY/JUNE 2013, NOV/DEC 2013. APRIL/MAY 2022)
3. Explain the Servlet operation in detail with sample servlet program. (U)
(MAY / JUNE 2011)
4. Explain in detail with an example the dynamic content generation by a servlet. (U)
(MAY/JUNE 2012, MAY/JUNE 2014)
5. What is Session? Explain how client state is maintained using session and also
38
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Explain about session tracking and session management using an example. (U)
(NOV / DEC 2011)
6. Write a servlet to illustrate the principles of Cookies and explain. (C)
(MAY/JUNE 2013, MAY/JUNE 2014)
7. Explain how java servlets perform session handling. (U) (MAY / JUNE 2012)
8. Write a servlet to illustrate the principles of Cookies and explain. (A)
(MAY/JUNE 2013, MAY/JUNE 2014)
9. Explain the use of cookies for tracking requests with a program. (C) (NOV/DEC 2016)
10. Write a Java servlet to display net salary of employee. Use JDBC connectivity to get employee
details from data base. (A) (MAY/JUNE 2013)
11. Explain the JDBC and its components. (U) (APRIL/MAY 2022)
12. What is JDBC? What is the use of it? Write and explain steps to connect a Java application to the
DB with sample program. (U) (NOV/DEC 2015)
13. Elaborate briefly about JDBC database connection pool. How to setup in Java? Explain different
types of JDBC drivers in Java? (U) (APRIL/MAY 2021, 2022)
14. Explain the following with an example. (U)
a. JSP and Servlet b. Running JSP Application.
15. Write a client server JSP program to find simple interest and display the result in the client.
(C) (MAY / JUNE 2013)
16. Explain the JSP scripting components in detail with examples. (U) (NOV/DEC 2016)
17. Explain in detail about JSTL with necessary examples. (U)
18. Using HTML and JSP, design a scientific calculator. (C) (NOV/DEC 2015)
19. Assume that a database has a table Employee with two columns EmployeelD and Name. Assume
that the administrator user id and password to access the database table are, scott and tiger. Write
a JDBC program that can query and print all the entries in the table Employee. Make the
database connection using a type2 driver database.driver and connection string jdbc:db:oci. (C)
(MAY/JUNE 2016)
39
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
An introduction to PHP: PHP- Using PHP- Variables- Program control- Built-in functions- Form
Validation- Regular Expressions – File handling – Cookies – Connecting to Database. XML: Basic
XML- Document Type Definition- XML Schema DOM and Presenting XML, XML Parsers and
Validation, XSL and XSLT Transformation, News Feed (RSS and ATOM).
PART - A
40
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
5. Write the syntax for writing PHP scripts. (R)
A PHP script can be placed anywhere in the document.
A PHP script starts with <?php and ends with ?>:
<?php
// PHP code goes here
?>
The default file extension for PHP files is ".php".
A PHP file normally contains HTML tags, and some PHP scripting code.
6. Write the PHP script to print “Hello” message on the screen. (C)
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>
42
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Syntax
function functionName()
{
code to be executed;
}
There are two types of validation are available in PHP. They are as follows –
Client-Side Validation − Validation is performed on the client machine web browsers.
Server Side Validation − After submitted by data, The data has sent to a server and perform
validation checks in server machine.
Some of Validation rules for field:
Field Validation Rules
Name Should require letters and white-spaces
Email Should require @ and .
Website Should require a valid URL
Radio Must be selectable at least once
Check Box Must be checkable at least once
Drop Down menu Must be selectable at least once
<?php
function addFunction($num1, $num2)
{
$sum = $num1 + $num2;
echo "Sum of the two numbers is : $sum";
}
addFunction(10, 20);
?>
</body>
</html>
43
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Output:
Sum of the two numbers is : 30
<?php
setcookie("name", "John Watkin", time()+3600, "/","", 0);
setcookie("age", "36", time()+3600, "/", "", 0);
?>
18. What are the two sets of regular expressions offered by PHP?(U)
PHP offers functions specific to two sets of regular expression functions:
POSIX extended Regular Expressions
PERL compatible Regular Expressions
The ereg() function searches a string specified by string for a string specified by
ereg()
pattern, returning true if the pattern is found, and false otherwise.
The ereg_replace() function searches for string specified by pattern and replaces
ereg_replace()
pattern with replacement if found.
44
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
The eregi() function searches throughout a string specified by pattern for a string
eregi()
specified by string. The search is not case sensitive.
The eregi_replace() function operates exactly like ereg_replace(), except that the
eregi_replace()
search for pattern in string is not case sensitive.
The split() function will divide a string into various elements, the boundaries of
split()
each element based on the occurrence of pattern in string.
The spliti() function operates exactly in the same manner as its sibling split(),
spliti()
except that it is not case sensitive.
The preg_match() function searches string for pattern, returning true if pattern
preg_match()
exists, and false otherwise.
The preg_replace() function operates just like ereg_replace(), except that regular
preg_replace()
expressions can be used in the pattern and replacement input parameters.
The preg_split() function operates exactly like split(), except that regular
preg_split()
expressions are accepted as input parameters for pattern.
45
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
XML carries the data, does not present it: XML allows you to store the data irrespective
of how it will be presented.
XML is a public standard: XML was developed by an organization called the World Wide
Web Consortium (W3C) and is available as an open standard.
25. What do you mean by XML declaration? Give an example. (MAY/JUNE 2013)(U)
The XML declaration is a processing instruction that identifies the document as being
XML. All XML documents should begin with an XML declaration.
For example,
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
46
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
26. What is meant by a XML namespace?(April / May 2011, 2014, Nov / Dec 2012,
2013,NOV/DEC 2016)(U)
An XML namespace is a collection of element and attribute names. XML namespace
provide a means for document authors to unambiguously refer to elements with the same name
(i.e., prevent collisions).
Example:
<subject>Geometry</subject> // data for student from school
and
<subject>Cardiology</subject> // data for student from medicine
Both the markup uses the element “subject” to markup data. Namespace can differentiate these
two “subject” elements:
<highschool:subject>Geometry</highschool:subject>
and <medicalschool:subject>Cardiology</medicalschool:subject>
Example:
<root>
<highschool:subject xmlns:highschool="http://www.abcschool.edu/subjects">
Geometry
</highschool:subject>
<medicalschool:subject xmlns:medicalshool="http://www.rmc.org/subjects">
Cardiology
</medicalschool:subject>
</root>
47
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
28. What is meant by Document Type Definition?(U)
Rules that define the legal elements and attributes for XML documents are called
Document Type Definitions (DTD) or XML Schemas.
There are two different document type definitions that can be used with XML:
DTD - The original Document Type Definition
XML Schema - An XML-based alternative to DTD
Example DTD :
<!DOCTYPE note
[
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget to complete the work !</body>
< </note>
48
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Syntax
The syntax of internal DTD is as shown:
where root-element is the name of root element and element-declarations is where you declare
the elements.
Example
Following is a simple example of internal DTD:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE address [
<!ELEMENT address (name,company,phone)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT company (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
]>
<address>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</address>
XML Schema is commonly known as XML Schema Definition (XSD). It is used to describe
and validate the structure and the content of XML data. XML schema defines the elements,
attributes and data types. Schema element supports Namespaces. It is similar to a database schema
that describes the data in a database.
50
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Double A floating-point number 0, 12, -109.75, NaN
Long A whole number 1234567890, -1234567890
Int A whole number 12345, -12345
Short A whole number 12, -345
Date A date consisting of year, month and day 2005-05-10
Time A time consisting of hours, minutes and seconds 16:30:25-05:00
The structure of the node tree begins with the root element and spreads out to the child elements till
the lowest level.
The nodes in the node tree have a hierarchical relationship to each other.The terms parent, child,
and sibling are used to describe the relationships. Parent nodes have children. Children on the same
level are called siblings (brothers or sisters).
In a node tree, the top node is called the root
Every node, except the root, has exactly one parent node
A node can have any number of children
A leaf is a node with no children
Siblings are nodes with the same parent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE addresses SYSTEM "addresses.dtd">
<addresses>
<person idnum="0123">
<lastName>Doe</lastName>
<firstName>John</firstName>
<phone location="mobile">(201) 345-6789</phone>
<email>[email protected]</email>
<address>
<street>100 Main Street</street>
<city>Somewhere</city>
<state>New Jersey</state>
<zip>07670</zip>
51
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
</address>
</person>
</addresses>
The following tree of element nodes represents this document:
Following diagram shows how XML parser interacts with XML document:
52
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
"valid”. When a document fails to conform to a DTD or a schema, the validator displays an
error message.
43. What are the two types of XML parsers? And differentiate them.(U/AN)
Two types of XML Parsers:
1. Non-Validating XML Parsers
2. Validating XML Parsers
53
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
adheres to the rules of well-formed document.
adheres to the rules in the DTD used by the
XML document.
The Expat parser is an example of non- Microsoft MSXML parser is an example of a
validating parser. validating parser.
55
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
With XSLT you can add/remove elements and attributes to or from the output file. You can
also rearrange and sort elements, perform tests and make decisions about which elements to
hide and display, and a lot more.
A common way to describe the transformation process is to say that XSLT transforms an
XML source-tree into an XML result-tree.
53. When should the super global arrays in PHP be used? Which super global array in
PHP would contain a HTML form's POST data? (MAY/JUNE 2016)(AN)
PHP super global variable is used to access global variables from anywhere in the PHP
script.
PART – B
1. Discuss in detail about how to create and use variables in PHP with example program. (C)
2. What are the different data types available in PHP? Explain about converting between
different data types with example program. (U)
3. Write a PHP program using arithmetic operator. (C)
4. Explain the features of built-in functions in PHP with examples. (U) (APRIL/MAY 2022)
5. Write a PHP program to do string manipulation. (NOV / DEC 2015) (C)
6. Explain how user-defined functions are created in PHP. (U)
7. Explain how input from an XHTML form is received in a PHP program. (U)
8. How will you connect a PHP program with database? Explain with example application. (U)
9. Explain how cookies are handled in PHP. (U)
10. Explain in detail about using Regular Expressions in PHP. (U)
11. Explain XML DTD. (U) (APRIL/MAY 2022)
56
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
12. What are different types of DTD? Explain the same with example. (U)
13. Explain the role of XML name spaces with examples. (U) (MAY/JUNE 2012)
14. What is XML Schema? Explain how to create and use XML Schema document. (C)
(NOV/DEC 2015)
15. Explain how a XML document can be displayed on a browser. (U) (APRIL/MAY 2011)
16. Explain about DOM. (U) (MAY/JUNE 2014)
17. Explain Document Tree with an example. (U) (MAY/JUNE 2011, MAY/JUNE 2012)
18. Explain in detail about XSL. (U) (NOV/ EC 2013)
19. Give an XSLT document and a source XML document explain the XSLT transformation
process that produces a single result XML document. (U) (NOV/DEC 2012)
20. Explain in detail about XML parsers and validation. (U)(NOV/DEC 2015, MAY/JUNE 2016)
21. Elaborate on RSS. (U)
22. Create a webserver based chat application using PHP. The application should provide the
function functions. (C)
Login
Send message (to one or more contacts)
Receive messages(from one or more contacts)
Add/delete /modify contact list of the user
23. Discuss the application‟s user interface and use comments in PHP to explain the code clearly.
(U) (MAY/JUNE 2016)
24. List at least five significant differences between DID and XML schema for defining XML
document structures with appropriate examples. (AN) (MAY/JUNE 2016)
25. Explain the string comparison capability of PHP using regular expressions with an
example. (U) (NOV/DEC2016)
26. Explain the steps in connecting a PHP code to a database. (U) (NOV/DEC2016)
27. Explain in detail the XML schema, built in and user defined data type in detail. (U)
(NOV/DEC2016)
28. Design simple calculator using PHP. (C) (NOV/DEC2018)
29. Explain about the controls statements in PHP with example. (U) (NOV/DEC 2018)
30. Explain about DOM with the XML data processing. (U) (NOV/DEC2018)
31. Design a PHP application for College Management System with appropriate built-in functions
and database. (C) (NOV/DEC 2018)
32. What is spring framework ? What is use of it ? What are the advantages of Spring Framework?
(U) (APRIL/MAY 2021)
33. Using XSLT, how would you extract a specific attribute from an element in an Xml document?
When constructing an XML DTD, how do you create an external entity reference in an attribute
value ? (A) (APRIL/MAY 2021)
34. Write the HTML code for creating a feedback form as shown below. Include comments in
code to highlight the markup elements and their purpose. The HTML form should use POST for
submitting the form to a program ProcessContactForm.PHP. (C) (MAY/JUNE 2016)
57
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Internet Programming
UNIT – V
AJAX: Ajax Client Server Architecture – XML HttpRequest Object – Call Back Methods; Web
Services: Introduction – Java web services basics – Creating, Publishing, Testing and Describing a
web services (WSDL) – Consuming a web service – Database driven web services from an
application – SOAP.
PART - A
1. What is AJAX?(U)
AJAX = Asynchronous JavaScript and XML.
AJAX is a technique for creating fast and dynamic web pages.
AJAX allows web pages to be updated asynchronously by exchanging small amounts of data
with the server behind the scenes. This means that it is possible to update parts of a web page,
without reloading the whole page.
.
58
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
7. Write the syntax to send a request to the server using XMLHttpRequest object.(R)
To send a request to a server, we use the open() and send() methods of the
XMLHttpRequest object:
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
59
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
Method Description
Specifies the type of request, the URL, and if the request should be
handled asynchronously or not.
open(method,url,async) method: the type of request: GET or POST
url: the location of the file on the server
async: true (asynchronous) or false (synchronous)
Sends the request off to the server.
send(string)
string: Only used for POST requests
Property Description
responseText get the response data as a string
responseXML get the response data as XML data
11. List any four merits for usage of AJAX in web service. (NOV / DEC 2015,NOV/DEC
2016)(AN)
1. Reduce the traffic travels between the client and the server.
2. Response time is faster so increases performance and speed.
3. AJAX communicates over HTTP protocol.
4. Asynchronous calls to a web server allows client need not to wait for the arrival of all
data before start rendering.
5. If a section of a page encounters any error, other sections do not get affected and the data
entered by the user is also not lost.
12. What is meant by Web Services? Give any four examples. (U)
(NOV/DEC 2015, APRIL/MAY 2022)
A web service is a software component stored on one computer that can be accessed via
method calls by an application ( or other software component) on another computer over a
network. These software components are used by some software applications rather than by
end-users directly.
Example:
Weather forecast system.
Currency converters.
Credit card validation system.
Mashups
61
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
14. List some examples of web services. (May / June 2012)(R)
(1) Weather forecast system
(2) Currency converter
(3) Electronic payment processing system
(4) Credit card validation system
(5) Resource management system
16. Define WSDL Specification. List out its six major elements .(R)
WSDL is an XML grammar for describing web services. The specification itself
is divided into six major elements:
definitions - The definitions element must be the root element of all WSDL documents.
types -The types element describes all the data types used between the client and server.
message -The message element describes a one-way message, whether it is a single message
request or a single message response.
portType - It defines a web service, the operations that can be performed, and the
messages that are involved.
binding - The binding element describes the concrete specifics of how the service will be
implemented on the wire.
Service - The service element defines the address for invoking the specified service. Most
commonly, this includes a URL for invoking the SOAP service.
19. What are the SOAP Elements? Mention its use .(R)
a. An Envelope element that identifies the XML document as a SOAP message
b. A Header element that contains header information
62
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
c. A Body element that contains call and response information
d. A Fault element containing errors and status information
22. What is the role of a callback function in performing a partial page update in an AJAX
application ? (U)
The callback function uses partial page updates to display the data in the existing web
page without reloading the entire page. At the same time, the server may be responding to the
second request and the client-side may be starting to do another partial page update . The
callback function updates only a designated part of the page. Such partial page updates help
make web applications more responsive, making them feel more like desktop applications. The
web application does not load a new page while the user interacts with it.
AJAX Control Toolkit is a set of extenders that are used to extend the functionalities of the
ASP.NET controls. The extenders use a block of JavaScript code to add new and enhanced
capabilities to the ASP.NET controls. AJAX Control Toolkit is a free download available on
the Microsoft site. You need to install this toolkit on your system before using extenders.
63
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
WSDL is an integral part of Universal Description, Discovery, and Integration (UDDI), an
XML-based worldwide business registry.
WSDL is the language that UDDI uses.
WSDL is pronounced as 'wiz-dull' and spelled out as 'W-S-D-L'.
PART – B
1. What do you mean by AJAX? Write the advantages of AJAX. (U) (MAY/JUNE 2014)
2. Explain the AJAX client-server architecture with neat diagram. (U)
(NOV/DEC 2015, NOV/DEC 2016)
3. Explain about the object that helps AJAX reload parts of a web page without reloading the
whole page. (U) (NOV/DEC 2011, NOV/DEC 2018)
Illustrate the process of handling concurrent AJAX request. (U) (APRIL/MAY 2022)
4. Differentiate between synchronous and asynchronous Ajax requests. How to send an Ajax
request in JavaScript ? (April/May 2021)
5. Explain in detail about the XML HttpRequest object with example program. (U)
(NOV/DEC 2016)
6. Explain the steps for writing a Java Web Service server and a Java Web Service Client with an
example. (U) (MAY/JUNE 2012, NOV/ EC 2013)
7. Explain in detail about how to consume a web service with example. (U)
8. Develop a Java Web Service that would do arithmetic operations. (C) (MAY/JUNE 2014)
9. Describe the significance and working of WSDL with an example. (U) (NOV/DEC 2011)
10. Explain how an application can be connected with databases through web services with neat
example. (U)
11. Explain the SOAP elements in detail. (U)(NOV/DEC 2011, 2012, 2013, MAY/JUNE 2014)
12. Write short notes on: (i) SOAP (ii) WSDL. (U) (NOV / DEC 2015)
13. Compare and contrast the traditional web application architecture and AJAX based web
application architecture. (AN) (MAY/JUNE 2016)
14. Describe the structure of a WSDL document , its elements and their purposes with appropriate
examples. (U) (MAY/JUNE 2016)
64
III/VI SEM
PANIMALAR INSTITUTE OF TECHNOLOGY DEPT OF CSE
15. Explain in detail the steps in the creation, publishing and testing of a web services in detail.
(U) (NOV/DEC 2016)
16. Define SOAP and explain the building blocks of a SOAP message in detail. (U)
(NOV/DEC 2016)
17. Describe SOAP, UDDI and WSDL in detail. (U) (NOV/DEC 2018)
18. What are the Web service features and explain the components of a web service? How does a
web service work? (U) (APRIL/MAY 2021)
19. What are the two methods thread can be created in Java? Explain them each with an example
code. Mention the different thread methods. (U) (APRIL/MAY 2021)
20. Explain the following with proper example : (U) (APRIL/MAY 2021)
i) Exception handling
ii) Event handling
iii) Call back methods
iv) XML validation
65
III/VI SEM