Handout 07. Backend by Java Technologies (Environment Setup)
Handout 07. Backend by Java Technologies (Environment Setup)
Web development:
Backend by Java technologies
Environment
• Java JDK/JRE
• 1.8
• https://www.oracle.com/java/technologies/downloads/#java8-windows
• Tomcat
• Java Application Server
• Support Java servlet & JSP
• Tomcat 8 download: https://tomcat.apache.org/download-80.cgi
• Eclipse
• IDE by Java
• Download for Enterprise Java developer:
https://www.eclipse.org/downloads/packages/release/2024-03/r/eclipse-ide-enterprise-
java-and-web-developers
• MySQL
• Server, Workbench & JDBC (J connector)
• Using MySQL Installer: https://dev.mysql.com/downloads/installer
1
5/21/2024
Name Value
---- -----
Path C:\Program
1. Add JDK/bin to $PATH Files\PowerShell\7;C:\Program Files (x86)\Common
(enable execute java and Files\Oracle\Java\java8path…
2
5/21/2024
3
5/21/2024
<!DOCTYPE html>
<html>
<head><title>My Home Page</title></head>
<body>
<h1>Hello, world!</h1>
<p>My Name is so and so. This is my HOME.</p>
</body>
</html>
4
5/21/2024
• Web.xml
<web-app>
<display-name>Hello WebApp</display-name>
<servlet>
<display-name>HelloServlet</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/sayHello</url-pattern>
</servlet-mapping>
</web-app>
10
5
5/21/2024
11
Eclipse Tomcat
1. Menu: File / New / Others…
2. Select new Server / Apache / Tomcat 8.5
3. Double click on server Tomcats to config
4. Start server and check log
12
6
5/21/2024
13
Adding servlets
1. New Servlet: HelloServlet
2. Fill the contest (doGet() method)
3. Define Servlet name and mapping
in web.xml
4. Run project (with option restart
server)
5. Servlet is compiled and deployed
to Tomcat.
6. If we change the contents (servlet,
JSP), they are automatically
recompiled and deployed to
Tomcat
14