request 내장객체의 속성처리 메소드 예제
<%
request.setAttribute("RequestAttribute","requset 내장 객체");
%>
${requsetScope.RequestAttribute}
웹 브라우저에서 서버의 JSP페이지로 전달하는 정보를 저장
요청 파라미터란 사용자가 폼 페이지에 데이터를 입력한 후 서버에 전송할 때 전달되는 폼 페이지의 입력된 정보 형태
<!-- form page -->
<form action = "process.jsp" method ="post">
<input type = "text" name = "name" />
<input type = "submit" value ="전송" />
</form>
<!-- jsp page -->
<%
String name = request.getParameter("name")
%>
<%=name%>
<%
String hostValue = request.getHost("host");
%>
<%
Enumeration en = request.getHeaderNames();
while (en.hasMoreElements){
String headName = (String) en.nextElement();
Stirng headValue = request.getHeader(headname);
%>
<%=headName%> <%=headValue%>
<%
}
%>
서버의 JSP페이지에서 웹 브라우저로 전달하는 정보를 저장
응답 http 헤더 관련 메소드는 서버가 웹브라우저에 응답하는 정보에 헤더를 추가하는 기능을 제공
응답 http헤더 관련 메소드 종류
<%
response.setHeader("Cache_control" ,"use_cache");
response.setHeader("contentType" ,"text/html; charset = utf-8");
response.setIntHeader("Refresh",5); <!-- 5초마다 새로고침-->
%>
response 내장 객체는 웹 브라우저로 응답하기 위해 MIME유형, 문자 인코딩, 오류 메시지, 상태 코드 등을 설정하고 가져오는 응답 콘텐츠 관련 메소드 제공
<%
response.setCharacterEncoding("utf-8");
response.setContentType("text/html; charset = utf-8");
%>
<%
response.sendError(404,"요청 페이지를 찾을 수 없습니다.");
<!-- 응답할 오류 코드 및 오류 메세지 설정-->
%>
웹 브라우저에 data를 전송하는 출력 스트림 객체