Search Header Logo

JAVA-WEB Session02

Authored by haibt@rikkei.edu.vn rikkei

Instructional Technology

Professional Development

Used 3+ times

JAVA-WEB Session02
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Trong vòng đời của Servlet, phương thức nào được gọi đầu tiên?

doGet()

 init()

destroy()

 service()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

 Servlet xử lý mỗi yêu cầu thông qua phương thức nào?

execute()

service()

execute()

destroy()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

 Phương thức destroy() trong Servlet được gọi khi nào?

Khi Servlet reload

Khi Servlet khởi tạo

Mỗi khi request được gửi đến Servlet

Khi Servlet container dừng hoạt động

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Dữ liệu trong request được thiết lập bằng request.setAttribute() sẽ :

Tồn tại đến khi Servlet bị hủy

Tồn tại trong 1 request

Lưu trữ vào file log

Đồng bộ với session

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Phương thức doGet() phù hợp xử lý request cho trường hợp nào?

Gửi file đính kèm

Yêu cầu truy vấn để hiển thị dữ liệu

Cần truyền dữ liệu lớn

Gửi thông tin nhạy cảm

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Khi truyền danh sách sinh viên(students) từ Servlet sang JSP bằng RequestDispatcher , chúng ta sử dụng phương thức nào để gửi dữ liệu thông qua request:

request.getAttribute("students",students)

request.setAttribute("students", students)

request.addAttribute("students", students)

request.putAttribute("students", students)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Servlet sau in ra kêt quả gì?

protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {

    res.setContentType("text/html");

    PrintWriter out = res.getWriter();

    out.println("<h1>Hello Servlet</h1>");

}


Lỗi do chưa forward

Trang trắng

Hiển thị ở giao diện "Hello Servlet"

In ra console màn hình console "Hello Servlet"

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?