[servlet] error 메세지와 redirect, 응답코드
http://blog.naver.com/PostView.nhn?blogId=jaebum85&logNo=110188339738&categoryNo=18&parentCategoryNo=0&viewDate=¤tPage=1&postListTopCurrentPage=1
http://annehouse.tistory.com/194
================================
서블릿 페이지 : Dispatcher
================================
-----------> *.java (서블릿)
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setAttribute("result", result);
ServletContext sc = getServletContext(); //┌> 반드시 써주세요!!
RequestDispatcher rd = sc.getRequestDispatcher("/view.jsp");
rd.forward(request, response);
}
}
============================================================
JSP 페이지 - 스크립트릿<%..%>: Dispatcher
============================================================
<%
RequestDispatcher rd = request.getRequestDispatcher("/view.jsp");
rd.forward(request, response);
%>
============================================================
JSP 페이지 - jsp액션 태그 : Dispatcher
============================================================
//┌> request, response 객체를 넘겨 받는 page이자, 실행되는 page
<jsp:forward page="/view.jsp">
<jsp:param name="" value="" />
<jsp:forward>
-----------> view.jsp (뷰:jsp)
<%= (String)request.getAttribute("result") %>
'차근차근 > JAVA JSP' 카테고리의 다른 글
페이지 이동 방법들 (0) | 2014.07.26 |
---|---|
java에서 alert처리하기 (0) | 2014.07.26 |
RequestDispatcher dispatcher = request.getRequestDispatcher (0) | 2014.07.26 |
Spring Controller에서 뷰(JSP) 페이지로 값 넘기기 미완성 (0) | 2014.07.26 |
webview , popup창 (0) | 2014.07.26 |