当前位置:七道奇文章资讯网站建设网站编程
日期:2010-10-07 17:16:00  来源:本站整理

JSP获得服务器参数的代码[网站编程]

赞助商链接



  本文“JSP获得服务器参数的代码[网站编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:

JSP获得服务器参数

Baijinshan.tk代码

  <%@ page language="java" import="java.util.*" pageEncoding="GBK"%>

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

  <html>

  <head>

  <title>Server Info</title>

  <meta http-equiv="pragma" content="no-cache">

  <meta http-equiv="cache-control" content="no-cache">

  <meta http-equiv="expires" content="0">

  </head>

  <body>

  <%

  String SERVER_NAME = request.getServerName();

  String SERVER_SOFTWARE = getServletContext().getServerInfo();

  String SERVER_PROTOCOL = request.getProtocol();

  Integer SERVER_PORT = request.getServerPort();

  String REQUEST_METHOD = request.getMethod();

  String PATH_INFO = request.getPathInfo();

  String PATH_TRANSLATED = request.getPathTranslated();

  String SCRIPT_NAME = request.getServletPath();

  String DOCUMENT_ROOT = request.getRealPath("/");

  String QUERY_STRING = request.getQueryString();

  String REMOTE_HOST = request.getRemoteHost();

  String REMOTE_ADDR = request.getRemoteAddr();

  String AUTH_TYPE = request.getAuthType();

  String REMOTE_USER = request.getRemoteUser();

  String CONTENT_TYPE = request.getContentType();

  Integer CONTENT_LENGTH = request.getContentLength();

  String HTTP_ACCEPT = request.getHeader("Accept");

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

  String HTTP_REFERER = request.getHeader("Referer");

  HashMap infoMap = new HashMap();

  infoMap.put("SERVER_NAME", SERVER_NAME);

  infoMap.put("SERVER_SOFTWARE", SERVER_SOFTWARE);

  infoMap.put("SERVER_PROTOCOL", SERVER_PROTOCOL);

  infoMap.put("SERVER_PORT", SERVER_PORT);

  infoMap.put("REQUEST_METHOD", REQUEST_METHOD);

  infoMap.put("PATH_INFO", PATH_INFO);

  infoMap.put("PATH_TRANSLATED", PATH_TRANSLATED);

  infoMap.put("SCRIPT_NAME", SCRIPT_NAME);

  infoMap.put("DOCUMENT_ROOT", DOCUMENT_ROOT);

  infoMap.put("QUERY_STRING", QUERY_STRING);

  infoMap.put("REMOTE_HOST", REMOTE_HOST);

  infoMap.put("REMOTE_ADDR", REMOTE_ADDR);

  infoMap.put("AUTH_TYPE", AUTH_TYPE);

  infoMap.put("REMOTE_USER", REMOTE_USER);

  infoMap.put("CONTENT_TYPE", CONTENT_TYPE);

  infoMap.put("CONTENT_LENGTH", CONTENT_LENGTH);

  infoMap.put("HTTP_ACCEPT", HTTP_ACCEPT);

  infoMap.put("HTTP_USER_AGENT", HTTP_USER_AGENT);

  infoMap.put("HTTP_REFERER", HTTP_REFERER);

  Iterator it = infoMap.keySet().iterator();

  %>

  <table border="1">

  <%

  while (it.hasNext()) {

  Object o = it.next();

  %>

  <tr>

  <td>

  <%=o%>

  <td>

  <%=infoMap.get(o)%>

  </td>

  </tr>

  <%

  }

  %>

  </table>

  </body>

  </html>
 


  以上是“JSP获得服务器参数的代码[网站编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
  • JSP获得服务器参数的代码
  • 本文地址: 与您的QQ/BBS好友分享!
    • 好的评价 如果您觉得此文章好,就请您
        0%(0)
    • 差的评价 如果您觉得此文章差,就请您
        0%(0)

    文章评论评论内容只代表网友观点,与本站立场无关!

       评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
    Copyright © 2020-2022 www.xiamiku.com. All Rights Reserved .