Search Header Logo

JavaWeb - Session10

Authored by haibt@rikkei.edu.vn rikkei

Information Technology (IT)

Professional Development

Used 1+ times

JavaWeb - Session10
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

17 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Chú thích nào sau đây được sử dụng để đánh dấu một class là một Spring MVC Controller?

@Component

@Service

@Repository

@Controller

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Chú thích @Autowired trong Spring được sử dụng để làm gì?

Khai báo một bean mới.

Tự động tiêm (inject) các dependencies.

Đánh dấu một phương thức xử lý request.

Cấu hình cơ sở dữ liệu.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Sự khác biệt chính giữa @Controller và @Component là gì?

Không có sự khác biệt, chúng hoàn toàn giống nhau.

@Component là một chú thích chung, trong khi @Controller là một loại @Component chuyên biệt cho tầng web.

@Controller chỉ có thể được sử dụng với các lớp Service.

@Component chỉ được sử dụng cho các lớp Repository.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Chú thích nào được sử dụng để ánh xạ (map) một HTTP POST request tới một phương thức xử lý trong Controller?

@RequestMapping

@GetMapping

@PostMapping

@RequestMapping(method = RequestMethod.GET)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Để nhận giá trị của một tham số từ URL request, ví dụ: /users?id=123, trong phương thức xử lý của Controller, chúng ta sử dụng chú thích nào?

@ModelAttribute

@RequestParam

@RequestBody

@RequestBody

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Đối tượng nào sau đây được sử dụng để truyền dữ liệu từ Controller ra View trong Spring MVC?

HttpServletRequest

HttpSession

Model (hoặc ModelMap, ModelAndView)

ServletContext

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Khi sử dụng ModelAndView để truyền dữ liệu và chỉ định tên View, bạn làm thế nào?

Sử dụng phương thức addObject() và setViewName().

Sử dụng phương thức addAttribute() và setView().

Sử dụng phương thức put() và render().

Không thể thực hiện cả hai việc này cùng lúc với ModelAndView.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?