Upload
david-cruz
View
90
Download
0
Embed Size (px)
Citation preview
JSP (JavaServer Pages) とは?
“HTML内にJavaのコードを埋め込んでおき、 Webサーバで動的にWebページを生成してクライ
アントに返す技術のこと。”
Wikipediaより
redirect <HttpServletResponse>.sendRedirect(url);
• 意味:“再指示、再命令”
• クラス:HttpServletResponse
• 引数: Location (URL)
forward
• 意味:“転送”
• クラス: RequestDispatcher
• 引数: HttpServletRequest,
HttpServletResponse
<RequestDispatcher>.forward(request, response);
比較
redirectページ1要求
ページ2返却
ページ2要求
redirect命令
クライアント サーバ
forwardページ1要求
ページ2返却
クライアントサーバ
⚫ 4段階(2往復)⚫ 他サーバへのredirect可
2段階(1往復) ⚫
他サーブレットへ ⚫
引数をパス
要素 redirect(再指示) forward(転送)主な動き クライアントに他のurlをパス 他のサーブレットに処理をパス
挙動
1. クライアント: 要求 2. サーバ: redirect命令 3. クライアント: 要求 (redirect命令に従って)
4. サーバ: 返却
1. クライアント: 要求 2. サーバ: 返却
処理 クライアント側 サーバ側パフォーマンス やや遅い やや速い範囲 他サーバでも可 サーバ内クラス HttpServletResponse RequestDispatcherURL 新URL 元のURL
引数 Location (url) HttpServletRequest, HttpServletResponse
イラスト: Illust AC (http://www.ac-illust.com/)