protected void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException {
Fruit fruit_date = new Fruit (“いちご”, 700);
//①:語句を埋めてください。
request.setAttribute ("fruit", ①);
//②下記2行は何をしてる?
RequestDispatcher dispatcher=request.getRequestDispatcher ("WEB-INF/ex/fruit.jsp");
dispatcher. forward (request, response);
}
①fruit_date
②WEB-INF/ex/fruit.jspにフォワードしている
①インスタンス化したFruitクラスのデータ(fruit_date)をリクエストスコープに格納してます。
②Dispatcherって飛行機の管制官の意味らしいです。(管制塔で飛行機の行き先を指示する人たち)
行き先をdispatcherに格納して、dispatcher. forward (request, response);で行ってらっしゃ~いと飛ばしてるイメージで覚えましょう
Servletテスト 9/11 Fight★