<html>
<body>
<%
out.println("Hello This is your First JSP");
%>
</body>
</html>
|
This is your First JSP ready
In the browser you can http://localhost:8080/test.jsp
In the browser you can see "Hello This is your First JSP"
You normally give your file a .jsp extension, and typically install it in any place you could place a normal Web page.
Although what you write often looks more like a regular HTML file than a servlet, behind the scenes, the JSP page just gets converted to a normal servlet, with the static HTML simply being printed to the output stream associated with the servlet's service method.
JSP page is translated to a servlet and the servlet is compiled and loaded.
There are five main types of JSP constructs that you embed in a page: Scriptlet, expression, declaration, directives, and actions .
Scripting elements (Scriptlet, expression, declaration) specify Java code that will become part of the resultant servlet, directives let you control the overall structure of the servlet, and actions let you specify existing components that should be used, and otherwise control the behavior of the JSP engine.