[Java Servlet] The road of Senri is also the third step from the first step

Current progress

It still doesn't work with this alone From now on, we will link the transition source jsp with the Jakarta Servlet to be started. servlet12.png

[When creating a project in the first step](https://qiita.com/hatopo/items/3cd12bda5d995703c293#%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7% E3% 82% AF% E3% 83% 88% E4% BD% 9C% E3% 82% 8A% E3% 81% BE% E3% 81% 97% E3% 82% 87% E3% 81% 86), By checking [Generate web.xml deployment descriptor], I think that the following files are created under WEB-INF.


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

Probably the above code is also written automatically, but for the time being, explanation

Now, let's add various things under <welcome-file-list>


In <servlet-class>, specify the relative path of the file you want to call starting from the project folder (ServletApp). You can call ~ /ServletApp/login/LoginServlet.java by writing as above. Give <servlet-name> a temporary name for this class (use it just below)


In <url-pattern>, specify the action path of the form tag of the calling jsp. The jsp side is / ServletApp / mypage, but since this is the starting point of the project folder, it will be / mypage. For <servlet-name>, specify the name of the <servlet> you want to call.

This makes it possible to make screen transitions. servlet13.png The above is a series of flow

Let's run

Click the green icon on the server servlet14.png If the server does not appear, open the view with [Window]-[View View]-[Others] on the menu bar and select [Server] to open it. 2020-06-05.png ↑ Like this Let's specify http: // localhost: 8080 / ServletApp / login.jsp to display the screen. (If you specified login.jsp in <welcome-file> earlier, you can also display it in http: // localhost: 8080 / ServletApp /, so please try it.

It's too simple, but I was able to see the screen servlet15.png Try typing hatopo and pressing the login button ... servlet16.png You have successfully passed the parameters!

Continue to [Java Servlet] Senri no Michi from one step to the fourth step

Recommended Posts

[Java Servlet] The road of Senri is also the third step from the first step
[Java Servlet] The road of Senri is also the fifth step from the first step
[Java Servlet] The road of Senri is also the fourth step from the first step
[Java Servlet] Senri no Michi is one step to the second
The road from JavaScript to Java
From Java9, the constructor of the class corresponding to primitive types is deprecated.
[Promotion of Ruby comprehension (1)] When switching from Java to Ruby, first understand the difference.
The order of Java method modifiers is fixed
The story of learning Java in the first programming
Increment with the third argument of iterate method of Stream class added from Java9
[Java] Calculate the day of the week from the date (Calendar class is not used)
First touch of the Files class (or Java 8)
How to write Scala from the perspective of Java
The comparison of enums is ==, and equals is good [Java]
Java language from the perspective of Kotlin and C #
The first step to using Xib instead of StoryBoard
The story that .java is also built in Unity 2018
Get to the abbreviations from 5 examples of iterating Java lists
Java: The problem of which is faster, stream or loop
Road to Java Engineer Part2 What kind of language is Java?
[Java] Delete the specified number of characters from the end of StringBuilder
[Java] I felt as a java beginner. "Why is the first letter of the String type capitalized?" I faced the String type.
[Java beginner] Conversion from character string to numerical value-What is the parseInt method of the Integer class? ~
[Java] Beginner's understanding of Servlet-②
This is the first post.
Java is the 5th day
The milliseconds to set in /lib/calendars.properties of Java jre is UTC
Read the first 4 bytes of the Java class file and output CAFEBABE
From fledgling Java (3 years) to Node.js (4 years). And the impression of returning to Java
[Swift] The color of the Navigation Bar is different (lighter) from the specified color.
Is the version of Elasticsearch you are using compatible with Java 11?
Investigation method when the CPU of the server running java is heavy
Let's summarize the Java 8 grammar from the perspective of an iOS engineer