国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JSP > 正文

獲取jsp參數深度詳解

2024-09-05 00:18:05
字體:
來源:轉載
供稿:網友

  今天小編給大家分享一篇獲取jsp參數深度詳解,感興趣的朋友跟小編一起來了解一下吧!

  package coreservlets;

  import java.io.*;

  import javax.servlet.*;

  import javax.servlet.http.*;

  import java.util.*;

  /** Creates a table showing the current value of each

  * of the standard CGI variables.

  *

?

  * Taken from Core Servlets and JavaServer Pages

  * from Prentice Hall and Sun Microsystems Press,

  * http://www.coreservlets.com/.

  * ? 2000 Marty Hall; may be freely used or adapted.

  */

  public class ShowCGIVariables extends HttpServlet {

  public void doGet(HttpServletRequest request,

  HttpServletResponse response)

  throws ServletException, IOException {

  response.setContentType("text/html");

  PrintWriter out = response.getWriter();

  String[][] variables =

  { { "AUTH_TYPE", request.getAuthType() },

  { "CONTENT_LENGTH",

  String.valueOf(request.getContentLength()) },

  { "CONTENT_TYPE", request.getContentType() },

  { "DOCUMENT_ROOT",

  getServletContext().getRealPath("/") },

  { "PATH_INFO", request.getPathInfo() },

  { "PATH_TRANSLATED", request.getPathTranslated() },

  { "QUERY_STRING", request.getQueryString() },

  { "REMOTE_ADDR", request.getRemoteAddr() },

  { "REMOTE_HOST", request.getRemoteHost() },

  { "REMOTE_USER", request.getRemoteUser() },

  { "REQUEST_METHOD", request.getMethod() },

  { "SCRIPT_NAME", request.getServletPath() },

  { "SERVER_NAME", request.getServerName() },

  { "SERVER_PORT",

  String.valueOf(request.getServerPort()) },

  { "SERVER_PROTOCOL", request.getProtocol() },

  { "SERVER_SOFTWARE",

  getServletContext().getServerInfo() }

  };

  String title = "Servlet Example: Showing CGI Variables";

  out.println(ServletUtilities.headWithTitle(title) +

  "

/n" +

  "

" + title + "

/n" +

?

  "

/n" +

?

  "

/n" +

?

  "

CGI Variable Name Value");

?

  for(int i=0; i;>

  String varName = variables[i][0];

  String varValue = variables[i][1];

  if (varValue == null)

  varValue = "Not specified";

  out.println("

" + varName + " " + varValue);

?

  }

  out.println("

");

?

  }

  /** POST and GET requests handled identically. */

  public void doPost(HttpServletRequest request,

  HttpServletResponse response)

  throws ServletException, IOException {

  doGet(request, response);

  }

  }

  以上就是獲取jsp參數深度詳解,想必都了解了吧,更多相關內容請繼續關注錯新技術頻道。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 孟津县| 铁岭县| 枣阳市| 卢氏县| 两当县| 都昌县| 白城市| 永川市| 遂宁市| 枣庄市| 札达县| 思南县| 苗栗县| 黄大仙区| 耿马| 宿州市| 宜州市| 蚌埠市| 凌海市| 河东区| 息烽县| 梁平县| 江源县| 吴旗县| 宁南县| 浦东新区| 安多县| 常山县| 竹溪县| 阿勒泰市| 琼海市| 遂平县| 来凤县| 金阳县| 巨鹿县| 永仁县| 柏乡县| 苏尼特右旗| 开原市| 陵川县| 南和县|