They replied, “Believe in the Lord Jesus, and you will be saved—you and your household.”
[Acts 16:31]
1. Introduction
1. 4 . Hello World
Let's start with the traditional way of learning computer programming by writing a "Hello World" program.
Here's a detailed list of the topics
- 1.4.1 Create a Spring Boot Project.:
1.4.1 Create a Spring Boot Project:
[ File ] - [ New ] - [ Spring Starter Project ]
New Spring Starter Project
[ Name ] - Project Name
[ Type ] - Maven or Gradle
[ Packaging ] - War or Jar
[ Java Version ] - 22, 21, 17
[ Language ] - Groovy, Kotlin, Java
[ Group ] - Reverse Domain Address
[ Artifact ] - Unique App Name
[ Version ] - Develop Version
[ Description ] - About this App
[ Package ] - Directory Name ( Reverse Domain Address )
Dependencies Library
1.4.2 MVC Model:
- "MVC" stands for Model-View-Controller. It's a software architectural pattern commonly used in designing user interfaces and web applications.
1. Model: The model represents the data and the business logic of the application. It manages the data, logic, and rules of the application. It's responsible for retrieving data from the database, processing it, and storing it back.
2. View: The view represents the presentation layer of the application. It's responsible for displaying the data to the user in a specific format. The view gets data from the model and presents it to the user through the user interface.
3. Controller: The controller acts as an intermediary between the model and the view. It handles user input and interacts with both the model and the view to process user requests. It receives input from the user via the view, processes it (often involving the model), and updates the view accordingly.
- MVC separates the concerns of an application into three components: the model (data and logic), the view (presentation), and the controller (user interaction). This separation helps in making the application easier to maintain, test, and scale.
1.4.3 "Hello World"
[ com.example.helloworld ] - [ New ] - [ Class ]
Name - MainController
Don't forget to insert '@Controller' annotation
create index method to call index.html
create index.html
[ template ] - [ New ] - [ Other ]
wizards - html
File name - index
Run
1.4.4 Server to Client:
- Here, "model" refers to the model in the MVC architecture. This model represents the data of the application and includes the business logic. Typically, it retrieves data from the database, processes it, and handles storage. The model object is used by the controller to pass data to the view. Therefore, in "public String stc(Model model)", "model" is a parameter of the controller method, used as a tool to pass data from the controller to the view.
1.4.5 Client to Server:
- There are three common methods used when receiving data from users on the server: receiving each value individually, receiving data as a Map object, and receiving data as an object. Among these, the most frequently used approach is receiving data as an object. However, here let's explore the simplest method, which is receiving each value individually.
Basic html
Input fields - id, pw
Controller - @RequestParam : get a data each from client
Example :