Bertolt Brecht What a miserable thing life is: you're living in clover, only the clover isn't good enough.
servlet forward / redirect
category: java |
Tag List: dispatch    forward    java    jsp    redirect    response    servlet   
posted by : jazzvm
view count : 1065
2009-12-10 01:10:07, EST: 2009-12-09 11:10:07
posted about 9 months ago

response forward / redirect

struts, spring mvc ¸¦ ÁÖ·Î »ç¿ëÇÏ´Ù º¸´Ï, ¼ø¼öÇÏ°Ô servlet/jsp¿¡¼­ ¾î¶»°Ô ÇØ¾ß Çϳª ¸·¸·ÇØ Á³´Ù.

redirect

    response.sendRedirect("http://www.jazzvm.net/main.jazz");
    // following would be same!! (in the same domain)
    response.sendRedirect("/main.jazz");



forward

     getServletConfig().getServletContext().getRequestDispatcher( "/some.jsp" ).forward( request,response );

/* after add a simple utility method */
	RequestDispatcher dispatcher = HttpUtil.getDispacher(request, "/some.jsp");
	dispatcher.forward(request,response);


public class HttpUtil {

	public static RequestDispatcher getDispacher(HttpServletRequest request, String path) {
		return request.getSession(true).getServletContext().getRequestDispatcher(path);
	}
}


posted(2009-12-10): www.jazzvm.net/board/view.jazz?seq=1321

µµ¿òÀÌ µÇ¾ú°Å³ª, ÀǰßÀÌ ÀÖÀ¸½Ã¸é Ä¿¸àÆ®¸¦ ³²°ÜÁÖ¼¼¿ä. ±ÛÀ» ÀÛ¼ºÇÒ ¶§¿¡ Âü°í°¡ µË´Ï´Ù.
Please leave any comment or opinion regarding this posting. Particularly when you want to refer to this.
That would provide me with good motivation.

thanks --jazzvm

Name:   PWD:
Five Numbers[six six three nine seven] :   ex)[zero one two three four] : 01234
servlet forward / redirect jazzvm 2009-12-10 01:10:07