In tomcat, all JSP code should be copied (Deployed) into webapps folder and create own folder in webapps e.g jsp, in jsp folder copy all your jsp files. Remember, Java is case sensitive language.
1. JSP Example Simple Print on browser
<html>
<body>
<%
out.print("Hello World!");
%>
</body>
</html>
2. JSP Example Expression base print on browser
<html>
<body>
<%="Hello World!"%>
</body>
</html>
3. JSP Example Current date print on browser
<%@ page language="java" import="java.util.*" errorPage="" %>
<html>
<body>
Current Date time: <%=new java.util.Date()%>
</body>
</html>
In above example, we need to add package of date import=”java.util.*”
Run this jsp file on browser with URL path
http://localhost:8080/jsp/jspExample1.jsp
|