Wednesday, April 15, 2009

Exercises 1 lab 1

Write a program to display a “Hello World” message in the Web browser. In addition, display the host name and Session Id. Write JSP code using HTML code.

Solution:
<html>
<head>
<title>Welcome to our Website</title>
</head>
<body>
<marquee><font size="3" color="#FF0033">Hello World!! </font></marquee>
<font color = “#0000FF”> Hostname: <%= request.getRemoteHost() %><br>
<font color = “#0000FF”> Session Id: <%= session.getId() %>
</body>
</html>
The output of the program is as shown in Figure 2.1.

Figure 2.1: Output of Hello.jsp

0 nhận xét: