본문 바로가기

JAVA/JSP & Servlet

JSP 기본 실습 : request 내장변수

 

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

 

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>JSP : request</title>

</head>

<body>

<%

        String protocal = request.getProtocol();

        String server = request.getServerName();

        int port = request.getServerPort();

        String clientip = request.getRemoteAddr();

        String clienthost = request.getRemoteHost();

        String url = new String(request.getRequestURL());

        String uri = request.getRequestURI();

        String contextPath = request.getContextPath();

        String browser = request.getHeader("User-Agent");

       

        out.println("protocal : " + protocal + "<br />");

        out.println("server : " + server + "<br />");

        out.println("port : " + port + "<br />");

        out.println("clientip : " + clientip + "<br />");

        out.println("clienthost : " + clienthost + "<br />");

        out.println("url : " + url + "<br />");

        out.println("uri : " + uri + "<br />");

        out.println("contextPath : " + contextPath + "<br />");

        out.println("browser : " + browser + "<br />");

 

%>

 

</body>

</html>