0% found this document useful (0 votes)
8 views53 pages

Web Technology Lab

The document contains various HTML programs demonstrating the creation of interactive web pages, including an India map with clickable areas leading to city descriptions, a college information page with embedded and external styles, and a form validation script using JavaScript. It also includes instructions for installing and configuring the Tomcat web server. Additionally, there are examples of JSP for processing GET requests.

Uploaded by

niveudhaya05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views53 pages

Web Technology Lab

The document contains various HTML programs demonstrating the creation of interactive web pages, including an India map with clickable areas leading to city descriptions, a college information page with embedded and external styles, and a form validation script using JavaScript. It also includes instructions for installing and configuring the Tomcat web server. Additionally, there are examples of JSP for processing GET requests.

Uploaded by

niveudhaya05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PROGRAM:

/*[Link]*/
<html>

<head>

<title>India Map</title>

<head>

<body bgcolor="PINK">

<font face="Monotype Corsiva" color="BLUE" size="6">

<marquee direction="left" behavior="alternate">INDIA MAP </marquee>


</font>

<hr size="6" color="RED">

<map name="pagemap">

<area shape="rect" coords="194,151,247,219" href="[Link]">

<area shape="rect" coords="291,268,384,337" href="[Link]">

<area shape="rect" coords="100,337,197,384" href="[Link]">

<area shape="rect" coords="236,543,344,577" href="[Link]">


</map>

<img src="[Link]" usemap="#pagemap">

</body> <font color="#ff0000" size="5">

<p><b>Hints:</b><i>Click on the Name of the Cities in the map to know its


description</i></p>

</html>

/*[Link]*/
<html>

<body bgcolor="SKYBLUE">
<font face="Monotype Corsiva" size="18" color="RED">

<center><b><i><tt>Delhi is the capital of our INDIA<br> and <br>More IT

companies are Camped at Delhi</tt></i></b></center>

<a href="[Link]">Home Page</a>

</font>

</body>

</html>

/*[Link]*/
<html>

<body bgcolor="SKYBLUE">

<font face="Times New Roman" size="18" color="RED">

<center><b><i>Calcutta is the wealthy city in WEST BENGAL<br> and

<br>it has Famous "Sunderbans Forests"</i></b></center>

<a href="[Link]">Home Page</a>

</font>

</body>

</html>

/*[Link]*/
<html>

<body bgcolor="DARKGREEN">

<font face="Times New Roman" size="12" color="RED">

<center>MUMBAI is the capital of Maharashtra<br> and <br>it has Famous

India Gate</center>

<a href="[Link]">Home Page</a>

</font>
</body>

</html>

/*[Link]*/
<html>

<body bgcolor="BLACK">

<font face="Times New Roman" size="12" color="RED">

<center>Chennai is hte capital of Tamil Nadu<br> and <br>More IT

companies are camped at Chennai</center>

<a href="[Link]">Home Page</a>

</ font >

</body>

</html>

OUTPUT:
ii)Using Javascript to display the above
PROGRAM:
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">


<title>Image Map Example</title>

<style>

#map-container {

position: relative;

#info-box {

position: absolute;

top: 10px;

left: 10px;

padding: 10px;

background-color: #fff;

border: 1px solid #ccc;

border-radius: 4px;

display: none;

</style>

</head>
<body>

<div id="map-container">

<img src="c:\Users\A\Downloads\[Link]" alt="Example


Image Map" usemap="#hotspots">

<map name="hotspots">

<!-- Define hot spots with coordinates -->

<area shape="rect" coords="10,10,100,100" alt="Hotspot 1"

onclick="showInfo('Hotspot 1 Information')"> <area shape="circle"

coords="150,150,50" alt="Hotspot 2" onclick="showInfo('Hotspot 2

Information')">

<area shape="poly" coords="300,10,400,50,350,100" alt="Hotspot 3"

onclick="showInfo('Hotspot 3 Information')">

</map>

</div>

<div id="info-box"></div>

<script>

function showInfo(info) {

// Display related information in the info-box

var infoBox = [Link]("info-box");


[Link] = info;

[Link] = "block";

</script>

</body>
</html>

OUTPUT:
PROGRAM:
<! DOCTYPE html >

<html xmlns="[Link]

<head>

<title>Embedded style sheet</title>

<style type="text/css">

h1 {

font-family:arial; color:green; }

h2

font-family:arial;

color:red; left:20px; }

h3

font-family:arial; color:blue; }

font-sise:14pt;

font-family:verdana;

</style>

</head>

<body>

<h1> <center>This is created using embedded style sheet

</center>

</h1>
<h2>This line is allingned left and red colored;

</h2>

<p>

The embedded style sheet is the most commonly used style sheet This paragragh is return in
verdana font with font size of 14. </p>

<h3>

This is a blue <a href="[Link]">colored</a> line

</h3>

</body>

</html>

OUTPUT:

(ii) To Create a web page that displays college


information using various style sheets.
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>College Information</title>

<!-- Inline Styles -->

<style>

body {

font-family: Arial, sans-serif;

background-color: #f4f4f4;

margin: 0;

padding: 0;

box-sizing: border-box;

header {

background-color: #c683d7;

color: white;

text-align: center;

padding: 1em;

section {

margin: 20px;

padding: 20px;

background-color: #fff;

border-radius: 5px;

box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

h1 {

color: #333;

}
p{

line-height: 1.6;

color: #666;

footer {

background-color: #333;

color: white;

text-align: center;

padding: 1em;

position: fixed;

bottom: 0;

width: 100%;

</style>

<!-- Internal Styles -->

<style>

h2 {

color: #008080;

ul {

list-style-type: none;

padding: 0;

li {

margin-bottom: 8px;

</style>
<!-- External Styles -->

<link rel="stylesheet" href="[Link]">

</head>

<body>

<header>

<h1> ANNA UNIVERSITY IN PATTUKKOTTAI</h1>

</header>

<section>

<h2>About Us</h2>

<p>Welcome to our college! We are committed to providing quality education

and fostering a supportive learning environment.</p>

</section>

<section>

<h2>Courses Offered</h2>

<ul>

<li>CSE</li>

<li>EEE</li>

<li>ECE</li>

<li>CIVIL</li>

<li>MECH</li>

</ul>

</section>

<section>

<h2>Contact Information</h2>

<p>Email: info@[Link]</p>

<p>Phone: +91 9585511757</p>

<p>Website:[Link]</p>
</section>

<footer>

&copy; 2023 College Information

</footer>

</body>

</html>

OUTPUT:
PROGRAM:
<html>

<head>

<script type='text/javascript'>

function formValidator()

var firstname=[Link]('firstname');

var lastname=[Link]('lastname');

var addr=[Link]('addr');

var zip=[Link]('zip');

var Countries=[Link]('Countries');

var username=[Link]('username');

var email=[Link]('email');

var dd=[Link]('dd');

var mm=[Link]('mm');

var yyyy=[Link]('yyyy');

var comment=[Link]('comment');

var password=[Link]('password');

if(isAlphabet(firstname,"Please enter only letters for your First name"))

if(isAlphabet(lastname,"Please enter only letters for your Last name"))

if(isNumeric(dd,"Please enter a date"))

if(madeSelection(mm,"Please Choose"))

{
if(isNumeric(yyyy,"Please enter a year"))

if(isAlphanumeric(addr,"Enter Numbers and letters only for address"))

if(isNumeric(zip,"please enter a valid zip code"))

if(madeSelection(Countries,"Please Choose"))

if(lengthRestriction(username,6,8))

if(isAlphanumeric(password,"Enter Numbers and letters only for password"))

if(emailValidator(email,"Please enter a valid email address"))

if(notEmpty(comment,"Please fill the comment"))

[Link]("<b><i>Thank's for submitting your details</i></b>");

alert("Successful Entry!!");

return true;

}}}}}}}}}}}}

return false;

function notEmpty(elem,helperMsg)

if([Link]==0)

alert(helperMsg);
[Link]();

return false;

return true;

function isNumeric(elem,helperMsg)

var numericExpression=/^[0-9]+$/;

if([Link](numericExpression))

return true;

else

alert(helperMsg);[Link](); return false;

function isAlphabet(elem,helperMsg)

var alphaExp=/^[a-zA-Z]+$/; if([Link](alphaExp))

return true;

else

alert(helperMsg);

[Link]();
return false;

function isAlphanumeric(elem,helperMsg)

var alphaExp=/^[0-9, a-z a-z, 0-9, A-Z A-Z, - 0-9 . ]+$/;

if([Link](alphaExp))

return true;

else

alert(helperMsg);[Link](); return false;

function lengthRestriction(elem,min,max)

var unput=[Link];

if([Link]>=min&&[Link]<=max)

return true;

else

alert("Please enter between "+min+" and "+max+" charactters");

[Link]();

return false;
}

function madeSelection(elem,helperMsg)

if([Link]=="Please Choose")

alert(helperMsg);[Link](); return false;

else

return true;

function emailValidator(elem,helperMsg)

var emailExp=/^[0-9 a-z . a-z 0-9]+\@[a-z]+\.[a-z]{2,4}$/;

if([Link](emailExp))

return true;

else

alert(helperMsg);[Link](); return false;

</script>

<h1><center><b>
<font color="#347235">Please Enter YourDetails</font></b></center>

</h1>

</head>

<body bgcolor="LIGHTGREEN">

<hr>

<form onsubmit='return formValidator()' height="50%">

<table height="50%" border="3pt" align="center">

<tr><td><b>

<font color="#347235">First Name:</font></b></td>

<td><input type='text' id='firstname'/></td></tr><br />

<tr><td><b>

<font color="#347235">Last Name:</font></b></td>

<td><input type='text' id='lastname'/></td></tr><br />

<tr><td><b>

<font color="347235">Date of Birth(dd/mm/yyyy):</font></b></td>

<td><input type='text' id='dd' />

<select id='mm'>

<option>Please Choose</option>

<option value="1">Jan</option>

<option value="2">Feb</option>

<option value="3">Mar</option>

<option value="4">Apr</option>

<option value="5">May</option>

<option value="6">Jun</option>

<option value="7">Jul</option>

<option value="8">Aug</option>

<option value="9">Sep</option>
<option value="10">Oct</option>

<option value="11">Nov</option>

<option value="12">Dec</option>

</select>

<input type='text' id='yyyy' /></td></tr><br />

<tr><td><b>

<font color="#347235">Address:</font></b></td>

<td><input type='text' id='addr'/></td></tr><br />

<tr><td><b>

<font color="#347235">Zip code:</font></b></td>

<td><input type='text' id='zip'/></td></tr><br />

<tr><td><b>

<font color="#347235">Countries:</font></b></td>

<td><selectid='Countries'>

<option>Please Choose</option>

<option value="1">United Kingdom</option>

<option value="2">Afghanistan</option>

<option value="3">America</option>

<option value="4">India</option>

<option value="5">Tanzania</option>

<option value="6">Zimbabwe</option>

<option value="7">Switzerland</option>

</select>

<input type='text' id='yyyy' /></td></tr><br />

<tr><td><b>

<font color="#347235">Username(6-8 characters):</font></b></td>

<td><input type='text' id='username' /></td></tr><br />


<tr><td><b><font color="#347235">Password:</font></b></td>

<td><input type='password' id='password' /></td></tr><br />

<tr><td><b><font color="#347235">Email:</font></b></td>

<td><input type='text' id='email' /></td></tr><br />

<tr><td><b>

<font color="#347235">Comment:</font></b></td>

<td><textarea id='comment'cols="20"rows="5"

name="Address"></textarea></td></tr><br />

<tr><td><input type='submit' value='Check Form' /></td></tr>

</table>

</form>

</body>

</html>

OUTPUT:
[Link] :4 INSTALLING & CONFIGURING TOMCAT - WEBSERVER

DATE:

AIM:
INSTALLING & CONFIGURING TOMCAT WEBSERVER

PROCEDURE:
Step 1: Visit Apache Tomcat home page with a Web browser, and click the "Download" link

under the "Tomcat 7.0.70 Released" section. You will see the"Tomcat 7 Downloads" page.

Step 2: Click "32-bit Windows zip" link under "Binary Distributions" section. Youwill see the
download file save dialog box.(this supports jdk1.6 kit)

Step 3: Use the "Save file" option to save the download file
"[Link]" to a temporary folder.

Step 4: Unzip "[Link]" to file installation folder“C:\ apache-


tomcat-7.0.70”.

Step 5: Try to start Tomcat server by running the "startup" command in acommand
line window:

C:\ >cd apache-tomcat-7.0.70\bin

C:\ >cd apache-tomcat-7.0.70\bin>startup

The CATALINA_HOME environment variable is not defined correctlyThis environment variable is


needed to run this program

Step 6: To fix the missing environment variables, CATALINA_HOME,JAVA_HOME &


JRE_HOME,

● Click my computer->right click properties->Select Advance SystemSetting

● In this tab, Click Environment variable

● Click new in User variables for admin

● Enter variable name & Variable value


▪ CATALINA_HOME C:\apache-tomcat-7.0.70

▪ JAVA_HOME C:\Program Files\Java\

▪ JRE_HOME C:\Program Files\Java\jre7

Step 7: Configuring Tomcat Open “C:\apache-tomcat-7.0.70\conf” Folder It consist of the following


xml files [Link] [Link] Tomcat- [Link] [Link] Open [Link] in notepad &
modify default-listings-false to true Open [Link] & change port number 8080 to any other
(8081) if any application access the same port Open [Link] change reloadable attribute to
true on figuration procedure varies according to the version

Step 8: Try to start Tomcat server by running the "startup" command in a command
Line window:

OUTPUT:
RESULT:
Thus the Tomcat server is installed and configured successfully
PROGRAM:
//[Link]

<html>

<head>

<title>Processing get requests with data</title>

</head>

<body>

<form action = "Servlet3" method = "get">

<b><p><label>Enter Your name Please!! <br />

<input type = "text" name = "firstname" />

<input type = "submit" value = "Submit" />

</label></p></b>

</form> </body>

</html>

//[Link]

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

public class Servlet3 extends HttpServlet

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws


ServletException, IOException
{

String firstName = [Link]( "firstname" );

[Link]( "text/html" );

PrintWriter out = [Link]();

// send XHTML document to client

// start XHTML document [Link]( "<html>" );

// head section of document [Link]( "<head>" );

[Link]("<title>Processing get requests with data</title>" );

[Link]( "</head>" );

// body section of document [Link]( "<body>" );

[Link]( "<h1>Hello " + firstName + ",<br />" );

[Link]( "Welcome to Servlets!</h1>" );

[Link]( "</body>" );

// end XHTML document

[Link]( "</html>" );

[Link](); // close stream to complete the page

public String

getServletInfo() { return "Short description"; }

Program (ii)

Session tracking
[Link]

// Java Program to Illustrate Creation and last-accessed

// Times for a Session

// Import required java libraries


import [Link].*;

import [Link].*;

import [Link].*;

import [Link].*;

// Extend HttpServlet class

public class GfgSession extends HttpServlet

public void doGet(HttpServletRequest request,HttpServletResponse response)throws


ServletException, IOException

// Create a session object if it is already not

// created.

HttpSession session = [Link](true);

// Get session creation time

Date createTime= new Date([Link]());

// Get last access time of this web page.

Date lastAccessTime = new Date([Link]());

String title = "Welcome Back to GraceCollege";

Integer visitCount = new Integer(0);

String visitCountKey = new String("visitCount");

String userIDKey = new String("userID");

String userID = new String("GFG");


// Check if this is new comer on your web page.

if ([Link]()) {

title = "Welcome to GraceCollege";

[Link](userIDKey, userID);

else {

visitCount = (Integer)[Link]( visitCountKey);

visitCount = visitCount + 1;

userID= (String)[Link](userIDKey);

[Link](visitCountKey, visitCount);

// Set response content type

[Link]("text/html");

PrintWriter out = [Link]();

String docType= "<!doctype html public \"-//w3c//dtd html 4.0 "+"transitional//en\">\n";


[Link](docType + "<html>\n" + "<head><title>" + title + "</title></head>\n"+

"<body bgcolor = \"#f0f0f0\">\n"

+ "<h1 align = \"center\">" + title + "</h1>\n"

+ "<h2 align = \"center\">Gfg Session Information</h2>\n"

+ "<table border = \"1\" align = \"center\">\n"

"<tr bgcolor = \"#949494\">\n"

+ " <th>Session info</th><th>value</th>"

+ "</tr>\n"

"<tr>\n"

+ " <td>id</td>\n"
+ " <td>" + [Link]() + "</td>"

+ "</tr>\n"

"<tr>\n"

+ " <td>Creation Time</td>\n"

+ " <td>" + createTime + " </td>"

+ "</tr>\n"

"<tr>\n"

+ " <td>Time of Last Access</td>\n"

+ " <td>" + lastAccessTime + "</td>"

+ "</tr>\n"

"<tr>\n"

+ " <td>User ID</td>\n"

+ " <td>" + userID + "</td>"

+ "</tr>\n"

"<tr>\n"

+ " <td>Number of visits</td>\n"

" <td>" + visitCount + "</td>"

+ "</tr>\n"

+ "</table>\n"

+ "</body>"

+ "</html>");

}
[Link]

<web-app>

<servlet>

<servlet-name>GfgSession</servlet-name>

<servlet-class>GfgSession</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>GfgSession</servlet-name>

<url-pattern>/GfgSession</url-pattern

</servlet-mapping>

</web-app>

OUTPUT:
PROGRAM:
//[Link]
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Welcome to Online Examination!!!!</title>

</head>

<body>

Welcome to Online Examination!!!!

<form action="exam" method="get">

<label><p> Enter Your name Please!!<br/> <input type="text" name="name"/>

<br/>

<input type="submit" name="SUBMIT"/>

</p>

</label>

</form>

</body>

</html>
//[Link]

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

import [Link]; public class exam extends HttpServlet

protected void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

[Link]("text/html");

PrintWriter out=[Link]();

String name=[Link]("name");

[Link]("<html>");

[Link]("<head>");

[Link]("<title>Online Examination</title>");

[Link]("</head>");
[Link]("<body bgcolor=PINK>");

[Link]("<h2 align=center>Online Examination</h2><hr>");

[Link]("<h3 align=center> Welcome Mr."+name+"</h3><hr>");

[Link]("<h4><u>Terms and Conditions:</u></h4>");

[Link]("<ul type=disc>");

[Link]("<li>The Paper consists a set of five questions.</li>");

[Link]("<li>Every question consists of two options.</li>");

[Link]("<li>All must be answered</li></ul><hr>");

[Link]("<center><h5><u>Your Questions</u></h5></center>");

[Link]("<hr>"); [Link]("<form method=get action=exam2>");

[Link]("<p>[Link] System is a ................. </p>");

[Link]("<input type=radio name=q1 value=0>Hardware");

[Link]("<br>");

[Link]("<input type=radio name=q1 value=1>Software");

[Link]("<hr>");

[Link]("<p>[Link] of C Language is ................ </p>");

[Link]("<br>");

[Link]("<input type=radio name=q2 value=0>Dennis Richee");


[Link]("<br>");

[Link]("<input type=radio name=q2 value=1>James Thompson");

[Link]("<hr>");

[Link]("<p>[Link] of the following is a multitasking,multi user,multiprocessing);


[Link]("OS. ....... </p>");

[Link]("<br>");

[Link]("<input type=radio name=q3 value=0>MS DOS");

[Link]("<br>");

[Link]("<input type=radio name=q3 value=1>Windows NT");

[Link]("<hr>");

[Link]("<p>[Link] of Computers is ................. </p>");

[Link]("<br>");

[Link]("<input type=radio name=q4 value=1>Charles babbage");

[Link]("<br>");

[Link]("<input type=radio name=q4 value=0>Charles Dickson");

[Link]("<hr>");

[Link]("<p>[Link] is the current generation of computers ?</p>");

[Link]("<br>");

[Link]("<input type=radio name=q5 value=0>Fifth");


[Link]("<br>");

[Link]("<input type=radio name=q5 value=1>Sixth");

[Link]("<hr>");

[Link]("<input type=submit value=Done>");

[Link]("</form>");

[Link]("</body>");

[Link]("</html>");

public String getServletInfo()

return "A Servlet of the user";

//[Link]

import [Link];

import [Link];

import [Link];

import [Link];
import [Link];

import [Link];

import [Link];

public class exam2 extends HttpServlet

protected void doGet(HttpServletRequest request, HttpServletResponse

response)

throws ServletException,

IOException { int count=0,j;

[Link]("text/html ");

PrintWriter out=[Link]();

String q1=[Link]("q1");

String q2=[Link]("q2");

String q3=[Link]("q3");

String q4=[Link]("q4");

String q5=[Link]("q5");

if([Link]("1"))

{
count=count+1;

if([Link]("1"))

count=count+1;

if([Link]("1"))

count=count+1;

if([Link]("1"))

count=count+1;

if([Link]("1")

count=count+1;

}
[Link]("<html>");

[Link]("<head><title>Examination Results</title></head>"

[Link]("<body>");

[Link]("<h2 align=center<Online Examination</h2><hr>");

[Link]("<h3>Number of Questions answered correctly:</h3>"+count); if(count>=3)


{ [Link]("<hr><h3>Congrats!!! You Have Passed!!!</h3><hr>");

[Link]("<h4><b>Try Other Tests!!</b></h4>");

else

[Link]("<hr><h3>Sorry!!! You Have Failed!!!</h3><hr>");

[Link]("<h4><b>Try Again:</b></h4>");

[Link]("</body>");

[Link]("</html>");

public String getServletInfo()


{

return "A Servlet of the User";

OUTPUT:
PROGRAM:
//[Link]

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Welcome to Online Examination!!!!</title>

</head>

<body>

Welcome to Online Examination!!!!

<form action="exam" method="get">

<label><p> Enter Your name Please!!<br/> <input type="text" name="name"/>

<br/>

<input type="submit" name="SUBMIT"/>

</p></label>

</form>

</body>

</html>

//[Link]

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

public class exam extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response)


throws ServletException, IOException { [Link]("text/html");

PrintWriter out=[Link]();

String name=[Link]("name");

[Link]("<html>");

[Link]("<head>");

[Link]("<title>Online Examination</title>");

[Link]("</head>");

[Link]("<body bgcolor=PINK>");

[Link]("<h2 align=center>Online Examination</h2><hr>");

[Link]("<h3 align=center> Welcome Mr."+name+"</h3><hr>");

[Link]("<h4><u>Terms and Conditions:</u></h4>");

[Link]("<ul type=disc>");

[Link]("<li>The Paper consists a set of five questions.</li>");

[Link]("<li>Every question consists of two options.</li>");

[Link]("<li>All must be answered</li></ul><hr>");

[Link]("<center><h5><u>Your Questions</u></h5></center>");

[Link]("<hr>");

[Link]("<form method=get action=exam2>");

[Link]("<p>[Link] System is a ................ </p>");

[Link]("<input type=radio name=q1 value=0>Hardware");

[Link]("<br>");

[Link]("<input type=radio name=q1 value=1>Software");

[Link]("<hr>");

[Link]("<p>[Link] of C Language is ............... </p>");

[Link]("<br>");

[Link]("<input type=radio name=q2 value=0>Dennis Richee");

[Link]("<br>");
[Link]("<input type=radio name=q2 value=1>James Thompson");

[Link]("<hr>");

[Link]("<p>[Link] of the following is a multitasking,multi user,multiprocessing);


[Link]("OS. ....... </p>");

[Link]("<br>");

[Link]("<input type=radio name=q3 value=0>MS DOS");

[Link]("<br>");

[Link]("<input type=radio name=q3 value=1>Windows NT");

[Link]("<hr>");

[Link]("<p>[Link] of Computers is ................ </p>");

[Link]("<br>");

[Link]("<input type=radio name=q4 value=1>Charles babbage");

[Link]("<br>");

[Link]("<input type=radio name=q4 value=0>Charles Dickson");

[Link]("<hr>");

[Link]("<p>[Link] is the current generation of computers ?</p>");

[Link]("<br>");

[Link]("<input type=radio name=q5 value=0>Fifth");

[Link]("<br>");

[Link]("<input type=radio name=q5 value=1>Sixth");

[Link]("<hr>");

[Link]("<input type=submit value=Done>");

[Link]("</form>");

[Link]("</body>");

[Link]("</html>");

public String getServletInfo() { return "A Servlet of the user"; }

}
//[Link]

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

import [Link];

public class exam2 extends HttpServlet

protected void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException

int count=0,j; [Link]("text/html");

PrintWriter out=[Link]();

String q1=[Link]("q1");

String q2=[Link]("q2");

String q3=[Link]("q3");

String q4=[Link]("q4");

String q5=[Link]("q5");

if([Link]("1"))

count=count+1;

if([Link]("1"))

{ count=count+1;

}
if([Link]("1"))

count=count+1;

if([Link]("1"))

count=count+1;

if([Link]("1"))

count=count+1;

[Link]("<html>")

[Link]("<head><title>Examination Results</title></head>")

[Link]("<body>");

[Link]("<h2 align=center<Online Examination</h2><hr>");

[Link]("<h3>Number of Questions answered correctly:</h3>"+count);

if(count>=3)

[Link]("<hr><h3>Congrats!!! You Have Passed!!!</h3><hr>");

[Link]("<h4><b>Try Other Tests!!</b></h4>"); }

else

[Link]("<hr><h3>Sorry!!! You Have Failed!!!</h3><hr>");

[Link]("<h4><b>Try Again:</b></h4>"); }

[Link]("</body>");

[Link]("</html>");
}

public String getServletInfo() { return "A Servlet of the User"; }

OUTPUT:
PROGRAM:
//[Link]

<?xml version="1.0"?>

<?xml-stylesheet type="text/css" href="[Link]"?>

<!DOCTYPE student SYSTEM "[Link]">

<students>

<student>

<sno>801041</sno>

<sname>[Link]</sname>

<dob>05/081991</dob>

<address>Neyveli</address>

<m1>80</m1>

<m2>90</m2>

<m3>95</m3>

</student>

<student>

<sno>801049</sno> <sname>[Link]</sname>

<dob>22/07/1990</dob>

<address>Pondicherry</address>

<m1>90</m1>

<m2>95</m2>

<m3>80</m3>

</student>

<student>

<sno>801037</sno>

<sname>[Link]</sname>
<dob>21/01/1991</dob>

<address>Kanyakumari</address>

<m1>80</m1>

<m2>90</m2>

<m3>95</m3>

</student>

</students>

//[Link]

Student

[Link]:#aabbcc;width:100%;

Sno

display:block; color:GREEN; [Link]:25pt;

Sname

display:block; color:BLACK; [Link]:20pt;

Dob

display:block; color:BLUE; [Link]:15pt;

Address { display:block; color:BLUE; [Link]:15pt;

m1
{

display:block; color:BLUE; [Link]:15pt;

display:block; color:BLUE; [Link]:15pt;

m3

display:block; color:BLUE; [Link]:15p

//[Link]

<?xml version="1.0"?>

<!ELEMENT students (student+)>

<!ELEMENT student (sno,sname,dob,address,m1,m2,m3)>

<!ELEMENT sno (#PCDATA)>

<!ELEMENT sname (#PCDATA)>

<!ELEMENT dob (#PCDATA)>

<!ELEMENT address (#PCDATA)>

<!ELEMENT m1 (#PCDATA

!ELEMENT m2 (#PCDATA)>

<!ELEMENT m3 (#PCDATA)>
OUTPUT:

You might also like