아틴
Atin
아틴
전체 방문자
오늘
어제
  • 분류 전체보기 (460)
    • Devlopment (246)
      • 정리 글 (20)
      • MicroServices (0)
      • Reactive, Concurrenc.. (12)
      • Java (44)
      • Spring (20)
      • C,C++,Ruby,Python (52)
      • Mobile (39)
      • Web (35)
      • Tip & Info (14)
      • Unit Test (7)
    • Infra (44)
      • OS (21)
      • RDBMS (13)
      • NoSQL&Cache (5)
      • AWS (4)
    • Computer Science (11)
    • Etc (156)

블로그 메뉴

  • Home
  • Guestbook

공지사항

인기 글

태그

  • CSS
  • 아이폰
  • mysql
  • 전라도
  • Python
  • 자바
  • 정읍
  • Dungeons & Dragons
  • 안드로이드
  • Android
  • 해킨토시
  • 던젼 앤 드래곤즈
  • TRPG
  • 여행
  • C
  • Ruby on Rails
  • javascript
  • Linux
  • Java
  • jsp

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
아틴

Atin

Devlopment/Web

Forward & Redirect & Include

2008. 6. 29. 17:38
반응형
  • JSP
    • Forward
      • Basic
        <jsp:forward page="이동할 페이지" />

      • Parameter 1
        <jsp:forward page="이동할 페이지">
             <jsp:param name="one" value="value1" />
             <jsp:param name="two" value="value2" />
        </jsp:forward>

      • Parameter 2
        request.setAttribute("파라미터 이름", "파라미터 값");
        <jsp:forward page="이동할 페이지" />

    • Redirect
      • Basic
        response.sendRedirect(String location);

      • Parameter 1
        <%
             String paramData = "jsp redirect";
             response.sendRedirect("move.jsp?" + paramData);
        %>

      • Parameter 2 (GET)
        <%@ page import="java.net.URLEncoder" %>
        <%
             String value ="parameter";
             String encodedValue = URLEncoder.encode(value);
             response.sendRedirect("move.jsp?name" + encodedValue);
        %>
        // 특수문자를 url에 포함시킬 때 필요한 코딩

    • Include
      • Include Directive tag
        <%@ include file="page.jsp" %>

      • Include Action tag
        <jsp:include page="공통내용.jsp" />
        • 파라미터 넘기기
          <jsp:include page="incl.jsp">
              <jsp:param name="year" value="sophomore"/>
          </jsp:include>


  • Servlet
    • Forward
      RequestDispatcher dis = request.getRequestDispatcher("page.jsp");
      dis.forward(request, response);

    • Redirect
      response.sendRedirect("page.jsp");

    • Include
      RequestDispatcher dispatch = getServletContext().getRequestDispatcher("page.jsp");
      dispatcher.include(request, response);

    • Attribute Binding(Request에 속성 바인딩)
      • setAttribute(String name, Object obj)
        속성을 바인딩함

      • getAttribute(String name)
        바인딩된 속성을 얻어옴

      • removeAttribute(String name)
        바인딩 된 속성을 삭제함


반응형

'Devlopment > Web' 카테고리의 다른 글

li 메뉴  (0) 2008.07.08
Images Masking, 메뉴  (0) 2008.07.04
DB 프로그래밍  (0) 2008.06.29
쿠키(Cookie) & 세션(Session)  (0) 2008.06.29
Application 내장 객체  (0) 2008.06.29
파라미터 값 받기 & 한글 처리  (0) 2008.06.29
JSP Page Directive  (0) 2008.06.29
class vs. id  (0) 2008.06.25
id selector & Selectors can be contextual  (0) 2008.06.25
Grouping & Add Styles to Elements with Particular Attributes  (0) 2008.06.25
    'Devlopment/Web' 카테고리의 다른 글
    • 쿠키(Cookie) & 세션(Session)
    • Application 내장 객체
    • 파라미터 값 받기 & 한글 처리
    • JSP Page Directive
    아틴
    아틴

    티스토리툴바