Professional Documents
Culture Documents
Style.css
#heading1{
color: red;
font-size: 80px;
background-color:yellow;
text-align : center;
}
body
{
margin: 0;
padding: 0;
background-color:#abcadeba;
font-family: 'Arial';
}
.login
{
width: 300px;
overflow: hidden;
margin: auto;
margin: 20px 0 0 50px;
padding: 30px;
padding-left: 70px;
background: green;
border-radius: 55px ;
}
h2
{
text-align: center;
color: #277582;
padding: 20px;
}
Internal.html
<html>
<head>
<title>Creating Webpage using Internal Style Sheet</title>
<style>
#heading1
{
color:white;
font-size: 80px;
background-color:black;
text-align: center;
}
#heading2
{
color:yellow;
font-size:70px;
text-align:left;
}
.bclass{
background-color:darkmagenta;
}
#para
{
text-align:left;
</style>
</head>
<body class="bclass">
<h1 id="heading1">WELCOME TO STYLE SHEET </h1>
<h2 id="heading2">Introduction to Css</h2>
<p1 id="para">Accronym for"Cascading Style Sheet"</p1>
<p2 id="para">it is the language for describing the presentation of web pages</p2>
</body>
</html>
External.html
<html>
<head>
<title>Login form</title>
<link rel="stylesheet" type="text/css" href="G:\Nov 2020\online class\Ip
lab\exercise1\style.css">
<body style="background-color:tan">
<h2 id="heading1">User Login<br>
</h2>
<div class="login">
<form id="login" method="get" action=" ">
<label><b>Enter name
</b>
</label>
<input type="text" name="Entername" id= "entername" placeholder="Entername">
<br><br>
<label><b>Password
</b>
</label>
Internal Sheet
External Sheet
New.html
<html>
<head>
<title>Thank you form</title>
<style>
#heading1
{
color:purple;
font-size:50px;
text-align:center;
}
#heading2
{
color:#900C3F;
font-size:40px;
text-align:center;
}
#heading3
{
color:#0B0B61;
font-size:35px;
text-align:center;
}
#heading4
{
color:#61380B;
font-size:30px;
text-align:center;
}
OUTPUT
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
f1.add(b1);
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
t4=new TextField(20);
t5=new TextField(20);
b5=new Button("Add");
b6=new Button("Cancel");
f2.add(l1);f2.add(t1);
f2.add(l2);f2.add(t2);
f2.add(l3);f2.add(t3);
b5.addActionListener(this);
b6.addActionListener(this);
f2.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
f1.setVisible(true);
f1.show();
f2.setVisible(false);
} });
t6=new TextField(20);
t7=new TextField(20);
t8=new TextField(20);
b7=new Button("Add");
b7.addActionListener(this);
b8.addActionListener(this);
f3.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
t6.setText("");
t7.setText("");
t8.setText("");
f1.setVisible(true);
f1.show();
f3.setVisible(false);
} });
ch1=new Choice();
ch2=new Choice();
t9=new TextField(15);
b9=new Button("Add");
b9.addActionListener(this);
b10.addActionListener(this);
f4.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
t9.setText("");
f1.setVisible(true);
f1.show();
f4.setVisible(false);
} });
ch3=new Choice();
t11=new TextField(15);
t12=new TextField(15);
b11.addActionListener(this);
b12.addActionListener(this);
b13.addActionListener(this);
f5.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
t11.setText("");
t12.setText("");
f1.setVisible(true);
f1.show();
f5.setVisible(false);
} }); }
}catch(Exception e2){}
}
Book Entry
Add Member
Issue Books
Return Books
FileClient.java
import java.rmi.*;
public class FileClient
{
public static void main(String ar[])
{
try
{
String fileserverURL="rmi://"+ar[0]+"/FileServer";
FileServerIntf fileserverintf=(FileServerIntf)
Naming.lookup(fileserverURL);
System.out.println("The path of Source file is:"+ar[1]);
FileServerImpl.java
import java.io.*;
import java.rmi.*;
import java.rmi.server.*;
class FileServerImpl extends UnicastRemoteObject implements FileServerIntf
{
public FileServerImpl()throws RemoteException
{
}
public void FileCopy(String d1,String d2)throws
RemoteException,IOException
{
String Str;
FileReader fr=new FileReader(d1);
BufferedReader br=new BufferedReader(fr);
FileWriter fw=new FileWriter(d2);
while((Str=br.readLine())!=null)
{
Str=Str+"\n\r";
char buf[]=new char[Str.length()];
Str.getChars(0,Str.length(),buf,0);
fw.write(buf);
FileServerIntf.java
import java.io.*;
import java.rmi.*;
public interface FileServerIntf extends Remote
{
public void FileCopy(String d1,String d2)throws
RemoteException,IOException;
}
Client Window
@Override
public String getServletInfo() {
return "Short description";
}
}
ShowResHeader.java
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ShowResHeader extends HttpServlet {
static final String NEW_HOST = "http://www.amazon.in";
ShowResHeader
Login.html
<html>
<head>
<title>Login</title>
<meta charset="UTF-8">
link.html
<html>
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<style>
h2{
color:green;
}
</style>
</head>
<body>
<h2><a href="LogoutServlet">Logout</a></h2><br>
LoginServlet.java
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LoginServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse
response)throws
ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
request.getRequestDispatcher("link.html").include(request,response);
String name=request.getParameter("name");
String password=request.getParameter("password");
if(password.equals("admin123")){
out.print("Welcome,"+name);
HttpSession session=request.getSession();
session.setAttribute("name",name);
}
else
{
out.print("Sorry, username or password error!");
request.getRequestDispatcher("login.html").include(request, response);
}
LogoutServlet.java
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LogoutServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse
response)throws
ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
ProfileServlet.java
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)throws
ServletException, IOException
{
processRequest(request, response);
}
@Override
public String getServletInfo()
{
return "Short description";
}
}
Login page
Logout page