1. TTfile
  2. JSP File
  3. How to convert HTML to JSP?

How to convert HTML to JSP?

JSP allows you to embed snippets of the Java programming language into HTML tags to create interactive content. HTML pages are static in that each time a user loads the page, the content will appear the same. JSP allows for dynamic content to be added to HTML pages, so that each time the user reloads the page, the content changes. For example, we will go through a sample where every time a user reloads the page, the date and time are changed automatically to reflect the current date and time.



Step 1

Open a new page in Notepad. Type the beginning and closing HTML tags with some space in between both tags. This specifies that the content will be in HTML.


Step 2

Type the opening body tag in the line below 6 and the closing body tag in the line directly above 7. Keep some empty lines between the opening and closing body tags. The rest of the lines between these two tags will specify the action the website will follow:


Step 3

Insert the following line at the top before the <HTML> tag:


This line declares that you are importing the java.util package because you will be using the date function. Java packages consist of classes of related functions.

Step 4

Insert the following tag after the <BODY> tag:


The 5 are JSP tags that specify an action needs to be taken with the function that is provided.

Step 5

Save the page with a .jsp extension.