What Is a JSP Page?
A JSP page is a text document that contains two types of text: static data, which can be expressed in any text-based format (such as HTML, SVG, WML, and XML), and JSP elements, which construct dynamic content.The recommended file extension for the source file of a JSP page is .jsp. The page can be composed of a top file that includes other files that contain either a complete JSP page or a fragment of a JSP page. The recommended extension for the source file of a fragment of a JSP page is .jspf.
Sample JSP Page example - helloworld.jsp Page
<%@page import="java.time.LocalTime"%>
<%@page import="java.time.LocalDate"%>
<html>
<body>
<h3>Hello World of Java!</h3>
Date and Time on Server : <%=LocalDate.now()%> <%=LocalTime.now()%>
</body>
</html>
Running JSP HelloWorld JSP Page
Right-click on helloworld.jsp file and run as the server will deploy JSP application on the tomcat server.
Once the JSP program up and running in tomcat server, just hit http://localhost:8080/jsp-helloworld/helloworld.jsp link in a browser will display below page on the screen:
Comments
Post a Comment