1. Create a jsp that prints hello world.
<%@page language="java" contentType="text\html" pageEncoding= "ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<title>JSP FILE</title>
<style>
body{
background-color:lightblue;
</style>
</head>
<body>
<center> <h1 style="color:tomato;border:3px solid brown;">Hello world!</h1> </center>
<center> <h1 style="color:green;border:2px solid burlywood;">Hello world!</h1> </center>
<center> <h1 style="color: blue;border:2px solid violet;">Hello world!</h1> </center>
</body>
</html>
OUTPUT:
2. Create jsp that prints current date and time.
<%@page import="java.io.*,java.util.*,javax.servlet.*"%>
<!DOCTYPE html>
<html>
<head>
<title>display current date & time </title>
</head>
<body>
<center> <h3>display current date & time </h3> </center>
<%
Date date =new Date();
out.print("<h4 align=\"center\">"+date.toString()+"</h4>");
%>
</body>
</html>
OUTPUT:
3. Create a jsp that add and subtract two numbers.
index.html
<html>
<head>
<title>Enter two numbers to add up</title>
</head>
<body>
<form action="./add.jsp">
First number: <input type="text" name="t1"/>
Second number: <input type="text" name="t2"/>
<input type="submit" value="SUBMIT" />
</form>
</body>
</html>
ADD.JSP
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> enter two numbers to add up</title>
</head>
<body>
<%= "<h1> the sum
is"+(Integer.parseInt(request.getParameter("t1"))+Integer.parseInt(request.getParameter("t2")))+
"</h1>"%>
</body>
</html>
OUTPUT:
4. Create a jsp for login module.