Wednesday, April 15, 2009

Exercises 6 lab 1

Write a program using JSP to display the hostname and the path of the JSP file.

Solution:
<html>
<head>
<title>JSP Example</title>
</head>
<body>
<p>
<LI>The path of this JSP file is: <%=request.getRequestURI()%>
<LI>The Hostname is: <%= request.getRemoteHost() %><br>
</p>
</body>
</html>
The output of the program is as shown in Figure 2.7.

Figure 2.7: Output of Path.jsp

0 nhận xét: