[Java Servlet] The road of Senri is also one step to the first
What is Servlet?
Mechanism for realizing Web application in Java
What is a web application?
Take a membership site as an example
- Enter user information in the client (PC or smartphone) to log in
- The server receives the user information sent
- Check if the user and password match using a database etc.
- If it matches, display My Page, if it is incorrect, return to the login screen and display an error message.
An image like the one below
The information sent to the server is called "request", and the information sent from the server is called "response".
Also, the client screen is composed of a file called jsp instead of HTML (the contents are almost the same as HTML, and java code can also be written).
Why Jakarta Servlet
Personally, I think it's more important to create a web application by hand and feel the flow of processing, rather than suddenly doing frameworks such as Strtus and Spring.
Let's make a project
The introduction has become longer, but I will make it immediately
Move the cursor to [Package Explorer] in Eclipse and right-click
Click [New]-[Other]
Click [web]-[Dynamic web project]
- Entering "dynamic" in the search is faster
Enter any name in the project and click [Next]
I won't touch the other items basically, but keep in mind that you will need the Target Runtime and Dynamic web module version values later.
Click [Next]
Check [Generate web.xml Deployment Descriptor] and click [Finish]
Done!
Let's make a server
There is also a method to prepare Tomcat and Apache separately, but this time it is implemented with Tomcat built in Eclipse
Click [Window]-[Show View]-[Other]
Select Server and click OK
- Entering "server" in the search is faster
This will bring up Server on Eclipse, right click in that area
Click [New]-[Server]
From [Choose server type], select a server that has the same Tomcat version as [Target runtime] that you remembered in [When creating a project](#Create a project), and click [Next].
From the [Available] field, select the project you just created and click [Add].
After confirming that you have moved to the [Configured] field, click [Finish].
Completion & environment construction completed
I will create a file from the next
[Java Servlet] The road of Senri is also the second step from the first step