FlowerBombs
페이지 상태 유지 본문
페이지 상태 유지 페이지가 연속적으로 이동할 때 이전 페이지의 변수를 유지해야 할 경우 사용할 수 있는 기법.
GET 방식의 경우
이전 페이지에서 전달된 파라미터를 URL에 누적시켜 전달한다.
1 2 3 4 5 | <% String w = request.getParameter("w"); String h = request.getParameter("h"); %> <a href = "hello.jsp?w=<%=w%>%h=<%=h%>&name=helloworld>click</a> | cs |
POST방식의 경우
이전 페이지에서 전달된 파라미터를 hidden field에 포함시켜 submit 처리한다.
1 2 3 4 5 6 7 8 | <% String w = request.getParameter("w"); String h = request.getParameter("h"); %> <form method="post" action="foo.jsp"> <input type="hidden" name="w" value="<%=w%>" /> <input type="hidden" name="h" value="<%=h%>" /> </form> | cs |
1 2 3 | <ul> <li>...</li> <input type="hidden"> | cs |
'JAVA > JSP' 카테고리의 다른 글
정규표현식 활용 (0) | 2019.03.07 |
---|---|
웹 페이지 강제 이동 처리 (0) | 2019.03.07 |
구글 앱 비밀번호 생성 (0) | 2019.03.06 |
WebHelper 에 적용된 기능 (0) | 2019.03.06 |
웹 페이지 상태 유지 기법 ( GET / POST) (0) | 2019.03.05 |
Comments