主頁(yè) > 知識(shí)庫(kù) > jsp源碼實(shí)例3(獲取jsp各種參數(shù))

jsp源碼實(shí)例3(獲取jsp各種參數(shù))

熱門標(biāo)簽:地圖標(biāo)注制作道路 廣州三五防封電銷卡 四川電信外呼系統(tǒng)靠譜嗎 長(zhǎng)春回?fù)芡夂粝到y(tǒng)廠家 山東智能云外呼管理系統(tǒng) 珠海銷售外呼系統(tǒng)運(yùn)營(yíng)商 外呼系統(tǒng)啥意思 電銷外呼系統(tǒng) 排行榜 地圖標(biāo)注創(chuàng)業(yè)項(xiàng)目入駐
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.
* P>
* Taken from Core Servlets and JavaServer Pages
* from Prentice Hall and Sun Microsystems Press,
* http://www.coreservlets.com/.
* copy; 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) +
"BODY BGCOLOR=\&;#FDF5E6\&;>\n" +
"H1 ALIGN=\&;CENTER\&;>" + title + "/H1>\n" +
"TABLE BORDER=1 ALIGN=\&;CENTER\&;>\n" +
"TR BGCOLOR=\&;#FFAD00\&;>\n" +
"TH>CGI Variable NameTH>Value");
for(int i=0; ivariables.length; i++) {
String varName = variables[0];
String varValue = variables[i][1];
if (varValue == null)
varValue = "I>Not specified/I>";
out.println("TR>TD>" + varName + "TD>" + varValue);
}
out.println("/TABLE>/BODY>/HTML>");
}

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

public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}

標(biāo)簽:潮州 玉樹 保定 吳忠 紹興 廣元 北海 肇慶

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《jsp源碼實(shí)例3(獲取jsp各種參數(shù))》,本文關(guān)鍵詞  jsp,源碼,實(shí)例,獲取,各種,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《jsp源碼實(shí)例3(獲取jsp各種參數(shù))》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于jsp源碼實(shí)例3(獲取jsp各種參數(shù))的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章