Simple JSP Example using Eclipse
We are writing a simple JSP code using Eclipse IDE and executing it using a web application server (Tomcat).
Step 1: Create a Dynamic project as shown
Step 2: Type the project name of your choice and click Next.
Step 3: Now select the checkbox “Generate web.xml deployment descriptor” and click on Finish button.
Step 4: Once the project is created, you can see the project structure as in the screen below.
Step 5: Now create a JSP file under the WebContent folder as shown below.
Step 6: Name the file as goeduhub.jsp and click on Finish button.
Step 7: Now open the file goeduhub.jsp and paste the below contents in it.
goeduhub.jsp |
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<body>
<% out.print("Welcome to Goeduhub ");%>
<p>Login Date: <%= (new java.util.Date())%></p>
</body>
</html>
|
Step 8: Now to execute this JSP, we need to configure a web server (in our case it is Tomcat 9). Now select the file goeduhub.jsp and select Run As > Run on Server as shown below.
To know step by step guide to install and setup Tomcat Server with Eclipse Click here
Step 9: Choose the Tomcat version on your system. In our case it is “Tomcat v9.0 Server” and click Finish.
Step 10: Output
For more RTU V Sem Advance Java Lab Experiments Click here