[JAVA] About redirect and forward

I am a beginner in programming. Output what you learned as a method to move the processing page to another page with JSP and Servlet.

Q: What is the difference between redirect and forward?

A: The process until the transition is different

redirect   ↓ (1) A request from the client to display page A on the server. (2) Instruct the client to move from page A to page B from the server. ③ Redirect instruction from client to server to move to page B ④ The result of page B is sent from the server

forward   ↓ ① Request page A from the client to the server (2) The server automatically copies the process to page B and sends the result to the client.

Basically forward is better!

Because ... ** ・ Request information can be taken over ** ** ・ Better performance than redirect ** etc ....

Timing to use redirect

・ When accessing an external server

[Reference source] https://www.atmarkit.co.jp/ait/articles/0407/06/news077.html

Recommended Posts

About redirect and forward
About Bean and DI
Learning memo 01 (forward / redirect)
About gets and gets.chomp
About encapsulation and inheritance
About Serializable and serialVersionUID
About for statement and if statement
About synchronized and Reentrant Lock
Rails "render method" and "redirect method"
About Ruby hashes and symbols
[Java] About String and StringBuilder
About the same and equivalent
About classes and instances (evolution)
About pluck and ids methods
Consideration about classes and instances
About Java Packages and imports
About Ruby and object model
About Ruby classes and instances
About instance variables and attr_ *
About self-introduction and common errors
JSP-About the MVC model of Servlet, redirect forward, and scope
About C # lambda expressions and Linq
About fastqc of Biocontainers and Java
Learn more about gems and bundlers
About the equals () and hashcode () methods
[Java beginner] About abstraction and interface
About Ruby single quotes and double quotes
About Gradle's setup phase and execution phase
About Ruby product operator (&) and sum operator (|)
About go get and go install from Go1.16
About removeAll and retainAll of ArrayList
About =
About if statement and branch processing
About object-oriented inheritance and about yield Ruby
About Java primitive types and reference types
Consideration about Rails and Clean Architecture
This and that about Base64 (Java)
About Docker, disguise server and container
[Swift] A note about function and closure
About the operation of next () and nextLine ()
[About JDBC that connects Java and SQL]
About the difference between irb and pry
About the mechanism of the Web and HTTP
Find out about instance methods and self