Screen transition by Post method [Java]

Introduction

When studying how to create a web app, you will come across many words such as JSP, Servlet, form and Post / Get methods. I think it's a place where many words come out at once and it's easy to get confused. Therefore, here we will introduce the Post method using very simple code.

The environment is Eclipse.

What is the Post method?

The Post method is one of the request methods in a web app. I think it is often introduced with the Get method. The difference between the two lies in how the parameters are passed to the web server. The Post method passes the parameters in the Request area, while the Get method passes them in the URL.

Screen transition

Create a program that transitions to end.jsp by clicking the button from start.jsp. Each code is as follows. Only the part of the body tag is described.

start.jsp


<body>
start
<form method="post" action="end.jsp">
	<button>click</button>
</form>

</body>

end.jsp


<body>
end
<a href="start.jsp">back</a>

</body>

The execution result is as follows. If you just want to change the screen, you can use the a tag like end.jsp. However, it is possible to send parameters to the Web server by specifying Post as method using the form tag like start.jsp. For example, if you create a text box inside the form tag, put characters in the text box and click the button, you can send the input value of the text box to the web server.

reference

-JSP Servlet: Java server-side practice Java language series Nobuyuki Inoue (Author)

Recommended Posts

Screen transition by Post method [Java]
Screen transition method
[Java Swing] Screen transition by CardLayout
Screen transition by [Android Studio] [Java] button
Screen transition with swing, java
Java method
java (method)
Java method
[Java] method
[Java] method
Eclipse screen layout change method (Java version)
[java] HttpURLConnection POST
Screen transition memorandum
Java8 method reference
[Java] forEach method
JavaFX8 screen transition
java8 method reference
[Java] Random method
[Java] split method
Test post (SHA-256 mining for blockchain by Java)
[Java] Dynamic method call by reflection of enum (enum)
JAVA DB connection method
Java learning 2 (learning calculation method)
About Java method binding
[Java ~ Method ~] Study memo (5)
About method splitting (Java)
Studying Java 8 (see method)
Search by POST request with Azure Search + Java Apache HttpClient
Java programming (class method)
POST JSON in Java
[Java] Basic method notes
[Java] Throw a request and display the screen ② (GET / POST)
[Java] Throw a request and display the screen (GET / POST)
Summary of values returned by the Spliterator characteristics method #java
[Java] New Thread generation method (2)
[Swift] Simple screen transition summary
Java GC method determination conditions
Java Silver Study Method Memo
Android development ~ Screen transition (intent) ~
Create a java method [Memo] [java11]
Java test code method collection
Object-oriented summary by beginners (Java)
[Java Silver] About equals method
[Java] Timer processing implementation method
[Java] Random number generation method (Random)
Java methods and method overloads
POST Json in Java ~ HttpURLConnection ~
Screen transition Information transfer memorandum
Animation settings at screen transition
Benefits of Java static method
[Java Silver] Array generation method
[Java] New Thread generation method (1)
Search and execute method by name from instance with processing (java)
[Swift] Implement screen transition and pass by value with Segue and present
[Java] I tried to make a maze by the digging method ♪
Rails Direct hit prohibition method (Do not transition to another person's edit screen by entering the URL)