Anda di halaman 1dari 17

Java and CGI programming laboratory manual Yogeesha H C, Asstt.

Prof, KVGCE, Sullia

Sub Code: CSL78


Develop and execute the following programs using HTML and PERL.
Create Database using MYSQL wherever necessary.

1. a) Program to display various Server information like – Server Name, Server


Software, Server protocol, CGI Version etc .
b) Program to accept UNIX command from a HTML form and to display the output
of the command executed.
2. a) Program to accept the User Name and display a greeting message.
b) Program to keep track of the number of visitors, visited the web page and display.
the counter with proper headings.
3. Program to display a greeting based on the access time of the Web server. Also to verify whether the
webmaster is currently logged in.
4. Program display a digital clock which display the current time of the server.
5. Program to display the current contents of the table in a database.
6. Program to insert new name and age information entered by the user into the database.

Develop and execute the following programs using HTML and PHP.
Create Database using MYSQL wherever necessary.

7. Program to query the database and to display the result on a web page.
8. Program to accept book information viz. Accession number, title, authors, edition and publication
from a web page and to store those in a database.
9. Program to search a book for a title given by the user on the web page and display the search results
with proper headings.

Develop and execute the following programs using


HTML and JAVA Servlets .

10. a) Program to accept user name and display a greeting message.


b) Program to change the background color of the page based on the color selected
by the user.
11. Program to display a greeting based on the access time of the server.
12. Program to create and display a cookie.
13. Program to create a session and display session information viz. session ID, creation
time and last accessed.

14. Program to request server information viz. Request Method, URL, Protocol and
Remote address.
15. Program to accept User name and address and display them in a web page by
passing parameters.

Note: One exercise must be asked in the examination.


The assignment of the exercise must be based on lots.

Page 1 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

1. a) Program to display various Server information like – Server Name, Server Software,
Server protocol, CGI Version etc .
#! /usr/bin/perl

print "Content-Type: text/html\n\n";


print "<html>\n\n";
print "<body><h1>About the Server</h1>";
print "<hr>";
print "Server Name: ", $ENV{SERVER_NAME}, "<br>\n";
print "Running on Port: ", $ENV{SERVER_PORT}, "<br>", "\n";
print "Server Software: ", $ENV{SERVER_SOFTWARE}, "<br>", "\n";
print "Server Protocol: ", $ENV{SERVER_PROTOCOL}, "<br>", "\n";
print "CGI Revision: ", $ENV{GATEWAY_INTERFACE},"<br>", "\n";
print "<hr>\n";
print "</body></html>\n";

Solution no. 2

#! /usr/bin/perl
print "Content-Type: text/html\n\n";
print "<html>\n\n";
print "<body><h1>About the Server</h1>";
foreach ($key(keys(%ENV))
{
print "<hr>";
print "$key : $ENV{$key}";
print "<hr>";
}
print "</body></html>\n";

1. b) Program to accept UNIX command from a HTML form and to display the
output of the command executed.

#!/usr/bin/perl
use CGI ':standard';
use CGI::Carp qw(warningsToBrowser);

if(param)
{
print header();
print start_html(-title=>"Unix Command",-bgcolor=>"Green",-text=>"blue");

$cmd=param("command");
$res=`$cmd`;
print b("output of $cmd is:"),br()",
"<pre>",
b("$res"),
"</pre>";

print start_form();
print submit(-value=>"Back");
print end_form();

print end_html();
}

Page 2 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

else
{
print header();
print start_html(-title=>"Unix Command",-bgcolor=>"yellow",-text=>"blue");
print start_form(),textfield(-name=>"command",-value=>" "),
submit(-name=>"submit",-value=>"Execute"),reset();
print end_form();
print end_html();
}

2. a) Program to accept the User Name and display a greeting message

#!/usr/bin/perl
use CGI ':standard';
use CGI::Carp qw(warningsToBrowser);

if(param)
{
print header();
print start_html(-title=>"Unix Command",-bgcolor=>"Green",-text=>"blue");

$cmd=param("command");
print b("Hello $cmd"),br();
print start_form();
print submit(-value=>"Back");
print end_form();
print end_html();
}
else
{
print header();
print start_html(-title=>"Enter user name",-bgcolor=>"yellow",-text=>"blue");
print start_form(),textfield(-name=>"command",-value=>" "),submit(-name=>"submit",-
value=>"Submit"),reset();
print end_form();
print end_html();
}

2. b) Program to keep track of the number of visitors, visited the web page and
display the counter with proper headings.

#!/usr/bin/perl

use CGI ':standard';


use CGI::Carp qw(warningsToBrowser);

print header();
print start_html(-title=>"WebPage Counter",-bgcolor=>"Pink",-text=>"blue");

open(FILE,'<count.txt');
$count=<FILE>;
close(FILE);

$count++;
open(FILE,'>count.txt');
print FILE "$count";
print b("This page has been viewed $count times");

Page 3 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

close(FILE);
print end_html();

3. Program to display a greeting based on the access time of the Web server. Also to
verify whether the webmaster is currently logged in.

#!/usr/bin/perl

use CGI ':standard';


print header();
print start_html(-title=>"Program 3",-bgcolor=>"#f00f0f",-text=>"blue");

if (param)
{
($s,$m,$h)=localtime(time);
br();
br();
$name=param("username");
br();
if($h>11&$h<18)
{
print "Good Afternoon";
}

if($h<12)
{ print "Good Morning";
}

if($h>18)
{ print "Good night";
}

print b(" Mr. $name");


hr();
$webmaster=param("webm");

if(`/usr/bin/w -h -s|grep $webmaster `)


{
print br,br,"Webmaster is logged in!!! ",br,br;
}
else
{
print br,br, "Webmaster not logged in !!!",br,br;
}

print start_form(),br,submit(-value=>"Back"),end_form();

else
{
print "<valign=right>",start_form(),b("Name "),textfield(-
name=>"username"),br,br,"<valign=right>",",b("Webmaster"),textfield(-
name=>"webm"),br,br," ","<valign=right>", submit(-value=>"Submit"),"
",reset(),end_form;
}

Page 4 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

4. Program display a digital clock which display the current time of the server.

#!/usr/bin/perl

use CGI ':standard';


print "Refresh: 1\n";
print "Content-Type: text/html\n\n";
print start_html(-title=>"Program 4",-bgcolor=>"Black",-text=>"white");
($s,$m,$h)=localtime(time);
print br,br,"The current system time is $h:$m:$s";
print br,br,hr,"In words $h hours $m minutes $s seconds";
print end_html;

5. Program to display the current contents of the table in a database.

#!/usr/bin/perl –w

use DBI;
use CGI ':standard';
print header();
print start_html(-title=>"Program 5",-bgcolor=>"yellow",-text=>"Black");
$dbh=DBI->connect("DBI:mysql:test","root","");
#or die "Couldnt connect:"DBI->errstr();

$sth=$dbh->prepare("select * from info");


$sth->execute;

while(($a,$b)=$sth->fetchrow())
{
print b("$a $b"),br;
}
print b("success"),br;
$sth->finish();
$dbh->disconnect();
6. Program to insert new name and age information entered by the user into the
database.

#! /usr/bin/perl

print "Content-type: text/html\n\n";


print "<HTML><TITLE>Result of the insert operation </TITLE>";
use CGI ':standard';
use DBI;
$dbh=DBI->connect("DBI:mysql:test","root","");
$name=param("name");
$age=param("age");
$qh=$dbh->prepare("insert into info values('$name','$age')");
$qh->execute();
$qh=$dbh->prepare("Select * from info");
$qh->execute();
print "<table border size=1><tr><th>Name</th><th>Age</th></tr>";

while ( ($name,$age)=$qh->fetchrow())
{
print "<tr><td>$name</td><td>$age</td></tr>";
}

Page 5 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

print "</table>";
$qh->finish();
$dbh->disconnect();
print"</HTML>";

7. Program to query the database and to display the result on a web page.

//7.html

<html>
<head><title>Program 7</title></head>
<body>
<form action=”7.php” method=”post”>
Enter the query <input type=”text” name=”query”>
<input type=submit>
</form>
</body>
</html>

-----------------------------------------------------

//7.php

<html>
<head><title>Database Query</title></head>
<body>
<?
$link=mysql_connect("localhost","root","");
mysql_select_db("test");
$q=$_POST["query"];
$var=mysql_query("$q");
echo"<table border size =1>";
echo"<tr><th>Name</th><th>Age</th></tr>";
while ($arr=mysql_fetch_row($var))
{
echo"<tr><td>$arr[0]</td><td>$arr[1]</td></tr>";
}
echo"</table>";
mysql_free_result($var);
mysql_close($link);
?>
</body>
</html>

8. Program to accept book information viz. Accession number, title, authors, edition
and publication from a web page and to store those in a database.

//8.html

<html>
<head><title>Program 8</title></head>
<body>
<h3>Book Details</h3>
<form action=”8.php” method=”post”>
Account Number <input type=”text” name=”accno”><br>
Title <input type=”text” name=”title”><br>

Page 6 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

Author <input type=”text” name=”author”><br>


Edition <input type=”text” name=”edn”><br>
Publisher <input type=”text” name=”pub”><br>
<input type=submit>
</form>
</body>
</html>

-----------------------------------------------------

//8.php

<html>
<head><title>Result Table</title></head>
<body>
<h3>Resulting table after the insert operation </h3>
<hr>
<?
$link=mysql_connect("localhost","root","");
mysql_select_db("test");
$acc=$_POST["accno"];
$title=$_POST["title"];
$author=$_POST["author"];
$edn=$_POST["edn"];
$pub=$_POST["pub"];
$t=mysql_query("insert into book values('$acc','$title','$author','$edn','$pub')");
$var=mysql_query("SELECT * FROM book");
echo"<table border size=1>";
echo"<tr><th>Accession number</th><th>Title</th><th>Author</th><th>
Edition</th><th>Publication</th></tr>";
while ($arr=mysql_fetch_row($var))
{

echo"<tr><td>$arr[0]</td><td>$arr[1]</td><td>$arr[2]</td>
<td>$arr[3]</td><td>$arr[4]</td></tr>”;

}
echo”</table>”;
mysql_free_result($var);
mysql_close($link);

?>
<hr>
<form action=”p8.html”>
<input type=”submit” value=”Back”>
</form>
</body>
</html>

9. Program to search a book for a title given by the user on the web page and
display the search results with proper headings.

//9.html

<html>
<head><title>Program 7</title></head>

Page 7 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

<body>
<form action=”9.php” method=”post”>
Enter the title of the book <input type=”text” name=”title”>
<input type=submit>
</form>
</body>
</html>

-----------------------------------------------------

//9.php

<html>
<head><title>Search Result </title></head>
<body>
<h3>Search Result </h3>
<hr>
<?
$link=mysql_connect(“localhost”,”root”,””);
mysql_select_db(“test”);
$t=$_GET[“title”];
$var=mysql_query(“ SELECT * FROM book WHERE title LIKE ‘$t’ “);
echo”<table border size=1>”;
echo”<tr><th>Accession number</th><th>Title</th><th>Author</th><th>Edition</th><th>
Publication</th></tr>”;

while ($arr=mysql_fetch_row($var))
{
echo”<tr><td>$arr[0]</td><td>$arr[1]</td><td>$arr[2]</td>
<td>$arr[3]</td><td>$arr[4]</td></tr>”;
}
echo”</table>”;
mysql_free_result($var);
mysql_close($link);
?>
<hr>
<form action=”p9.html”>
<input type=”submit” value=”Back”>
</form>
</body>
</html>

10. a) Program to accept user name and display a greeting message.

import java.lang.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class prg10a extends HttpServlet


{

public void doGet(HttpServletRequest req, HttpServletResponse res)

Page 8 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>CGI Programming- Servlet Program 10 A </title></head>");
out.println("<body>");
out.println("<h1>Program 10A: Greeting Program</h1>");
out.println("<h3>please Enter the User name :</h3>");
out.print("<form action=\"");
out.println("prg10a\" method=POST>");
//out.println("<form method=post action=/servlets-examples/prg10a>");
out.println("UserName: &nbsp&nbsp&nbsp&nbsp <input type=text name=username
value=\"\">");
out.println("<input type=submit value=Submit>");
out.println("<input type=Reset value=Clear>");
out.println("</form>");
out.println("</body>");
out.println("</html>");
}

public void doPost(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>CGI Programming- Servlet Program 10 A </title></head>");
out.println("<body>");
out.println("<h1>Program 10A: Greeting Program</h1>");
String username=req.getParameter("username");
out.println("<h2> Hello <font color=red> "+username+"</font>");
out.println("<br> &nbsp&nbsp Welcome to Greeting Web site:</h2>");
//out.println("<center><a href=/servlets-examples/prg10a Back</a></center>");
out.println("</body>");
out.println("</html>");

}
}

10. b) Program to change the background color of the page based on the color selected by the user.
import java.lang.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class prg10b extends HttpServlet


{

public void doGet(HttpServletRequest req, HttpServletResponse res)

Page 9 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

throws ServletException,IOException
{
PrintWriter out=res.getWriter();

String color=req.getParameter("color");

if(color==null)
{
color="white";

}
out.println("<html>");
out.println("<head><title>Program 10 B </title></head>");
out.println("<body bgcolor=\""+color+"\">");
out.println("<h1>Program 10A: Background Color Chooser Program</h1>");
out.println("<h3>please Choose the color in list :</h3>");
out.println("<form method=post action=/servlets- examples/prg10b>");
out.println("<select name=color>");
out.println("<option selected>Red</option>");
out.println("<option >green</option>");
out.println("<option >blue</option>");
out.println("<option >orange</option>");
out.println("<option >pink</option>");
out.println("<option >yellow</option>");
out.println("<option >magenta</option>");
out.println("<option >gold</option>");
out.println("<option >silver</option>");
out.println("<option >gray</option>");
out.println("<option >lavender</option>");
out.println("<option >light pink</option>");
out.println("<option >pista</option>");
out.println("<option >peech</option>");
out.println("<option >snuff</option>");
out.println("<option >peacock blue</option>");
out.println("<option >cement</option>");
out.println("</select>");
out.println("<input type=submit value=Submit>");
out.println("<input type=Reset value=Clear>");
out.println("</form>");
out.println("</body>");
out.println("</html>");
}

public void doPost(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
doGet(req,res);
}

Page 10 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

11. Program to display a greeting based on the access time of the server.
import java.lang.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class prg11 extends HttpServlet


{

public void doGet(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>Program 11 </title></head>");
out.println("<body>");

Calendar calendar=Calendar.getInstance();
int hour=calendar.get(Calendar.HOUR);
int minute=calendar.get(Calendar.MINUTE);
int second=calendar.get(Calendar.SECOND);

int ampm=calendar.get(Calendar.AM_PM);

out.println("Hello Dear User:<Br><Br><br><br>");

String str="PM";
if(ampm==0)
{
str="AM";
switch(hour)
{
case 0:
case 1:
case 2:
case 3:
case 4: out.println("It is MidNight, Have a great sleep");break;
case 5: break;
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:out.println("Good Morning");
}

Page 11 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

}
else
{
switch(hour)
{
case 0:
case 1:
case 2:
case 3:
case 4:out.println("Good Afternoon");break;
case 5:
case 6:
case 7:
case 8:out.println("Good Evening");break;
case 9:out.println("Have a nice dinner");break;
case 10:
case 11:out.println("Good Night; sleep well!");
}
}

out.println("<br><br>you have accessed this server at:");


out.println(hour+":"+minute+":"+second+":"+" "+str);
out.println(“</body>”);
out.println(“</html>”);
}

public void doPost(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
PrintWriter out=res.getWriter();
}
}

12. Program to create and display a cookie.

import java.lang.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class prg12 extends HttpServlet


{
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>Program 12 </title></head>");

Page 12 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

out.println("<body>");
out.println("<h1>Program to Create and Display the cookie</h1>");

//Display all cookies

Cookie[] cookies = req.getCookies();


if ((cookies != null) && (cookies.length > 0))
{
out.println("cookies: " + "<br>");
for (int i = 0; i < cookies.length; i++)
{
Cookie cookie = cookies[i];
out.print("Cookie Name: " + cookie.getName() + "<br>");
out.println(" Cookie Value: " + cookie.getValue() + "<br><br>");
}
}
else
{
out.println("no-cookies");
}

//create the cookie and display the current cookie

String cookieName = req.getParameter("cookiename");


String cookieValue = req.getParameter("cookievalue");
if (cookieName != null && cookieValue != null) {
Cookie cookie = new Cookie(cookieName, cookieValue);
res.addCookie(cookie);
out.println("<P>");
out.println("The current cookie setted is:<br><br>");
out.println("Name: " + cookieName +"<br>");
out.println("Value: " + cookieValue);
}

//form to add the new cookie

out.println("<br><Br>To Create Enter the Name and value of the cookie");


out.println("<form method=post action=/servlets-examples/prg12>");
out.println("Name: ");
out.println("<input type=text length=20 name=cookiename><br>");
out.println("Value:");
out.println("<input type=text length=20 name=cookievalue><br>");
out.println("<input type=submit></form>");
out.println("</body>");
out.println(“</html>”);
}

Page 13 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

public void doPost(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
doGet(req,res);
}
}

13. Program to create a session and display session information viz. session ID, creation
time and last accessed.

import java.lang.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class prg13 extends HttpServlet


{

public void doGet(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>Program 13 </title></head>");
out.println("<body>");
out.println("<h2>Session Creation and Display</h2>");
out.println("<br><hr><br>");
HttpSession session=req.getSession(true);
out.println("Session ID: &nbsp"+session.getId());
out.println("<br><br>Session Created on:");
out.println(new Date(session.getCreationTime()));
out.println("<br><br>Session Last accessed: ");
out.println(new Date(session.getLastAccessedTime()));
out.println("<br><hr><br><h3> Creation of New Session attribute</h3>");
out.println("<form method=post action=/servlets-examples/prg13>");
out.println("<br>Name of the session Attribute:");
out.println(" <input type=text name=attname value=\"\">");
out.println("<br>Value of the session Attribute:");
out.println(" <input type=text name=attvalue value=\"\">");
out.println("<br><input type=submit value=Submit><input type=reset name=CLear>");
out.println("</form>");
out.println("<hr>");
out.println("The Session Values:");

String attName = req.getParameter("attname");

Page 14 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

String attValue = req.getParameter("attvalue");

if (attName != null && attValue != null)


{
req.setAttribute(attName, attValue);
}

Enumeration names = req.getAttributeNames();


while (names.hasMoreElements())
{
String name = (String) names.nextElement();
String value = req.getAttribute(name).toString();
out.println(name + " = " + value + "<br>");
}

out.println("</body>");
out.println("</html>");
}

public void doPost(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
doGet(req, res);

}
}

14. Program to request server information viz. Request Method, URL, Protocol and
Remote address.

import java.lang.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class prg14 extends HttpServlet
{

public void doGet(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>Program 14 </title></head>");
out.println("<body>");
out.println("<h1>Server Information</h1>");
out.println("<br><hr><br>");
out.println("<br>Request URI: "+req.getRequestURI());

Page 15 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

out.println("<br>Method of Request: "+req.getMethod());


out.println("<br>Servlet Path: "+req.getServletPath());
out.println("<br>Path Information: "+req.getPathInfo());
out.println("<br>Path Translated Information: "+req.getPathTranslated());
out.println("<br>Query String: "+req.getQueryString());
out.println("<br>Remote User: "+req.getRemoteUser());
out.println("<br>Authorization Type: "+req.getAuthType());
out.println("<br>Content Length: "+req.getContentLength());
out.println("<br>Content Type: "+req.getContentType());
out.println("<br>Request Protocol: "+req.getProtocol());
out.println("<br>Request Scheme: "+req.getScheme());
out.println("<br>Server Name: "+req.getServerName());
out.println("<br>Server Port: "+req.getServerPort());
out.println("<br>Remote Address: "+req.getRemoteAddr());
out.println("<br>Remote Host: "+req.getRemoteHost());
out.println("<br>Character Encoding: "+req.getCharacterEncoding());
out.println("<hr>");
out.println("</body>");
out.println("</html>");
}

public void doPost(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
doGet(req,res);
}
}

15. Program to accept User name and address and display them in a web page by
passing parameters.
import java.lang.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class prg15 extends HttpServlet
{

public void doGet(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>Program 15 </title></head>");
out.println("<body>");
out.println("<h1>User Information</h1>");
out.println("<br><hr><br>");
out.println("<form method=post action=/servlets-examples/prg15");
out.println("Dear User.<br>");

Page 16 of 17
Java and CGI programming laboratory manual Yogeesha H C, Asstt. Prof, KVGCE, Sullia

out.println("Please Enter the following Information.<br><br>");


out.println("UserName: <input type=text name=username value=\"\"><br><br>");
out.println("Address: <input type=text name=address value=\"\"><br><br>");
out.println("<input type=submit value=Submit><input type=reset value=Clear>");
out.println("</form>");
out.println("</body></html>");
}

public void doPost(HttpServletRequest req, HttpServletResponse res)


throws ServletException,IOException
{
PrintWriter out=res.getWriter();
String username=req.getParameter("username");
String address=req.getParameter("address");
out.println("<html>");
out.println("<head><title>Program 15 </title></head>");
out.println("<body>");
out.println("<h1>User Information</h1>");
out.println("<br><hr><br>");
out.println("Dear User.<br>");
out.println("Your Information.<br><br>");
out.println("UserName: "+username+"<br>");
out.println("Address :"+address+"<br>");
out.println("<br><center><a href=/servlets-examples/prg15>Back</a></center>");
out.println("</body>");
out.println("</html>");

}
}

Page 17 of 17

Anda mungkin juga menyukai