When we send any request to the JSP program from the browser window, we pass the request URL in the browser window. In this process to send the data along with the request, the programmer also requires adding the query string to request URL explicitly. But this task is highly of technical. For that a graphical user interface is required which can generate a request which mayor may not hold the data. For this purpose, the programmer can use either HTML form or hyperlink to generate the request with or without data. The example of HTML to JSP communication is given below:
Program:
<html>
<title>HTML TO JSP COMM</title>
<body>
<center>
<font color=”blue” size=”8″><b>Date & Time is :</b></Font></center>
<h3 align=”center”><%java.util.Date d=new java.util.Date();out.println(d.toString());%>
</center>
</body>
</html>
Explanation of the above program
In order to display the date and time within the scriptlet tag (<%——-%>) we use the Date class, which prints the current date and time in the browser window. This Date class present in the util package, that’s why it needs to be imported.
<% java.util.Date d=new java.util.Date();
out.println(d.toString()) ;%>