PRJ301_-_SU_2024_-_Block_5_-_FE_2680.webp
free_spirit

PRJ301_-_SU_2024_-_Block_5_-_FE_2680.webp

Kizspy | Question: 28
(Choose 1 answer)
FUOVERFL
public class MyControllerServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { String data = "Hello from Controller";request.setAttribute("message", data);RequestDispatcher dispatcher = request.getRequestDispatcher("/myView.jsp");dispatcher.forward(request, response);}
} In the above source code, how to pass message from Controller to JSP for display?
A. Use 'response.sendData("Hello from Controller");'
B. Use 'response.writeAtrribute("message", "Hello from Controller");'
C. Use 'request.set("message", "Hello from Controller");'
D. Use 'request.setAttribute("message", "Hello from Controller");'

Thông tin

Category
PRJ301
Thêm bởi
free_spirit
Ngày thêm
Lượt xem
6,695
Lượt bình luận
42
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom