Aim: 6. Create A HTML File Which Demonstrates The Uses of Various Types of Lists. Procedure: Lists - HTML
Aim: 6. Create A HTML File Which Demonstrates The Uses of Various Types of Lists. Procedure: Lists - HTML
Aim: 6. Create A HTML File Which Demonstrates The Uses of Various Types of Lists. Procedure: Lists - HTML
6. Create a HTML file which demonstrates the uses of various types of lists.
PROCEDURE:
Lists.html:
<html>
<head>
<title>Types of lists</title>
</head>
<body>
<h1 align=left> Unordered List </h1>
<ul>
<li>sub1</li>
<li>sub2</li>
<li>sub3</li>
<li>sub4</li>
<li>sub5</li>
<li>sub6</li>
</ul>
<h2 align=left> Ordered List </h2>
<ol>
<li>sub1</li>
<li>sub2</li>
<li>sub3</li>
<li>sub4</li>
<li>sub5</li>
<li>sub6</li>
</ol>
<h3 align=left> Nested Listed </h3>
<ol>
<li>sub1</li>
<ul>
<li>sub1</li>
<li>sub2</li>
</ul>
<li>sub2</li>
<ul>
<li>sub1</li>
<li>sub2</li>
</ul>
<li>sub3</li>
<ul>
<li>sub1</li>
<li>sub2</li>
</ul></ol></body></html>
AIM:
PROCEDURE:
Table.html
<html>
<head>
<title>Railway time table</title>
</head>
<body>
<table border=2 align=center>
<tr><th>Name</th>
<th>Source</th>
<th>Destination</th>
<th>Fare</th>
</tr>
<tr>
<td>Gowthami</td>
<td>KKD</td>
<td>SEC</td>
<td>250</td>
</tr>
<td>Godavari</td>
<td>VSP</td>
<td>HYD</td>
<td>250</td>
</tr>
<td>Falaknama</td>
<td>BHU</td>
<td>SEC</td>
<td>250</td>
</tr>
<td>Ratnachal</td>
<td>VSP</td>
<td>VJA</td>
<td>250</td>
</tr>
</table>
</body></html>
AIM:
PROCEDURE:
Prog1.html:
<html>
<head>
<title>Prog1</title>
</head>
<body bgcolor="yellow">
<h1>From Prog1</h1>
</body>
</html>
Prog2.html:
<html>
<head>
<title>Prog2</title>
</head>
<body bgcolor="Red">
<h1>From Prog2</h1>
</body>
</html>
Prog3.html:
<html>
<head>
<title>Prog3</title>
</head>
<body bgcolor="Green">
<h1>From Prog3</h1>
</body>
</html>
Prog4.html:
<html>
<head>
<title>Prog4</title>
</head>
<body bgcolor="pink">
<h1>From Prog4</h1></body></html>
Frames.html:
<html>
<head>
<title>Frames</title>
<frameset rows="25%,25%,25%,25%">
<Frame src="prog1.html">
<Frame src="prog2.html">
<Frame src="prog3.html">
<Frame src="prog4.html">
</frameset>
</head>
</html>
AIM:
PROCEDURE:
Internal.html
<html>
<head>
<title>Internal Style Sheet</title>
<style type= "text/css">
h1{font-family:arial;color:yellow;font-size:30pt}
p{font-family:times new roman;font-size:15pt}
body{background:Green}
</style>
</head>
<body>
This line is effected by body selector.
<h1>This line is effected by h1 selector.</h1>
<p>This line is effected by p selector.</p>
</body>
</html>
Rules.css:
External.html:
<html>
<head>
<title>External Style Sheet</title>
<link rel="stylesheet" title="company" href="rules.css" type="text/css">
</head>
<body>
This line is effected by body selector.
<h1>This line is effected by h1 selector.</h1>
<p>This line is effected by p selector.</p>
</body>
</html>
AIM:
PROCEDURE:
Factorial.html:
<html>
<head>
<title>Factorial</title>
</head>
<body>
<script language="javascript">
var num,i,fact=1;
num=parseInt(window.prompt("Enter num:","0"));
for(i=1;i<=num;i++)
fact=fact*i;
document.writeln("The factorial is:",fact);
</script>
</body>
</html>
Armstrong.html:
<html>
<head>
<title>Armstrong</title>
</head>
<body>
<script language="javascript">
var num,a,rem,sum=0;
num=parseInt(window.prompt("Enter num:","0"));
a=num;
while(a!=0)
{
rem=a%10;
sum=sum+(rem*rem*rem);
a=a/10;
a=parseInt(a);
}
if(num==sum)
document.writeln(num," is Armstrong:");
else
document.writeln(num," is Not Armstrong");
</script>
</body>
</html>
AIM:
PROCEDURE:
Events.html:
<html>
<head>
<title>Events</title>
</head>
<body onload="showloaded()" onunload="saygoodbye()" >
<h1>Handling Events</h1>
<a href="#" onMouseOver="mouse()" >Hyperlink</a>
<form>
<input type="button" value="click me" onclick="clicked()" >
<input type="text" value="name" onselect="selected()" >
</form>
<script language="javascript">
function showloaded()
{
alert("Page is loaded");
}
function saygoodbye()
{
alert("Thanks for visiting");
}
function mouse()
{
alert("mouse over the link");
}
function clicked()
{
alert("Clicked the button");
}
function selected()
{
alert("Selected the text");
}
</script>
</body>
</html>
AIM:
PROCEDURE:
Generic servlet:
import javax.servlet.*;
import java.io.*;
public class SimpleGenericServlet extends GenericServlet
{
public void init() throws ServletException
{
System.out.println(“in init()”);
}
HTTP Servlet:
import javax.servlet.*;
import java.io.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SimpleHttpServlet extends HttpServlet
{
public void doGet(HttpServletRequest req , HttpServletResponse res)
throws ServletException , IOException
{
res.setContentType(“text/html”);
PrintWriter out=res.getWriter();
System.out.println(“in service()”);
out.close();
}
PROCEDURE:
Web.xml:
<web-app>
<servlet>
<servlet-name>is</servlet-name>
<servlet-class>cookiesservlet</servlet-class>
</serlvet>
<servlet>
<servlet-name>ib</servlet-name>
<servlet-class>cookiesservlet2</servlet-class>
</serlvet>
<servlet-mapping>
<servlet-name>is<servet-name>
<url-pattern>cookie1</url-pattern>
</servlet-mapping>
<servlet-name>ib<servlet-name>
<url-pattern>cookie2</url-pattern>
</servlet-mapping>
</web-app>
Home.html:
<html>
<body>
<form action="cookie">
<pre>
name:<input type="text" name="cname"/>
value:<input type="text" name="cvalue"/>
<input type"submit" value="setcookie"/>
</pre>
</form>
</body>
</html>
Cookieservlet1:
package com.nit.servletex.st;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class cookieservlet extends httpservlet
{
public void doGet(HttpServletRequest req,HttpServletResponce res)throws
ServletException,IOException
{
sting name=req.getparameter("cname");
sting value=req.getparameter("cvalue");
cookie c=new cookie(name,value);
res.addcookie(c);
res.setcontextType("text/html");
printWriter out=res.getWriter();
out.println("cookie has been set");
out.println("<a href=""cookieservlet2.java"click here</a>");
}//doget
}//class
Cookieservlet2:
package com.nit.servlet.st;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class cookieservlet2 extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws
ServletException,IOException
{
cookie c[]req.getCookies();
res.getcontextType("text/html");
PrintWriter out=res.getWriter();
for(int i=0;i<c.length;i++)
{
out.println("name:"+c[i].getname());
out.println("<br/>");
}//for
}//doget
}//class
AIM:
PROCEDURE:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class SessionServlet extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws
ServletException,IOException
{
res.setContentType(“text/html”);
PrintWriter out=res.getWriter();
out.println(“<html><head>”);
out.println(“<title>Session Tracking</title>”);
out.println(“<body> Session tracking using HTTP Session”);
HttpSession session=req.getSession();
if(session.isNew())
session.setAttribute(“pagecount”,1);
int count=(Integer)session.getAttribute(“pagecount”);
session.setAttribute(“pagecount”,count+1);
out.println(“you have accessed this page”+count+”time(s)”);
out.println(“currentdate:”+new Date().toString());
out.println(“session id:”+session.getId());
out.println(“session creation time:”);
out.println(new Date(session.getCreationTime()));
out.println(“session last accessed:”);
out.println(new Date(session.getLastAccessedTime()));
out.println(“maximum inactive interval:”);
out.println(new Date(session.getMaxInactiveInterval()));
out.println(“new session:”);
out.println(session.isNew());
out.println(“<a href=\””+res.encodeURL(“/myApp/SessionServlet”)+”\”>”);
out.println(“click here </a> to reload this page”);
}
}
AIM:
PROCEDURE:
Web.xml:
<web-app>
<servlet>
<servlet-name>is</servlet-name>
<servlet-class></servlet-class>
</serlvet>
<servlet>
<servlet-name>ib</servlet-name>
<servlet-class>com.nit.servletex.inboxServlet</servlet-class>
</serlvet>
<servlet-mapping>
<servlet-name>is<servet-name>
<url-pattern>login</url-pattern>
</servlet-mapping>
<servlet-name>ib<servlet-name>
<url-pattern>inbox</url-pattern>
</servlet-mapping>
</web-app>
Login.html:
<html>
<body>
<pre>
<form action="login">
username:<input type="text" name="uname">
password:<input type="text" name="password">
<input type="submit" value="login">
</form>
</pre>
</body>
</html>
Loginservlet:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class loginservlet extends HttpServlet
{
public boid doget(HttpServletRequest req,HttpServletResponce res)throws
ServletException,IOException
{
string uname=req.getparameter("uname");
string password=req.getparameter("password");
PrintWriter out=res.getWriter();
out.println("<html><body><pre>");
out.println("<a href=inbox?uname="+uname+">");
out.println("inbox</a>");
out.println("</pre></body></html>");
}
}
Inboxservlet:
import javax.servlet.http.*;
import java.io.*;
public class inboxservlet extends HttpServlet
{
public void doget(HttpServletRequest req,HttpServletResponce res)throws
ServletException,IOException
{
printWriter out=res.getWriter();
out.println("inbox details of user is "+req.getparameter("uname"));
}//doget
}//class