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.
Things You'll Need
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.
Type the opening body tag in the line belowand the closing body tag in the line directly above. 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:
Insert the following line at the top before thetag: <%@page contentType="text/html" import="java.util.*" %>This line declares that we are importing the java.util package because we will be using the date function. Java packages consist of classes of related functions.
Insert the following tag after thetag: <%= new java.util.Date() %>.The <% and %> are JSP tags that specify an action needs to be taken with the function that is provided.
Save the page with a .jsp extension.