Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JSP/Java»ñÈ¡HTTP headerÐÅÏ¢(request)Àý×Ó

<%
//header.jsp
out.println("Protocol: " + request.getProtocol() + "<br>");
out.println("Scheme: " + request.getScheme() + "<br>");
out.println("Server Name: " + request.getServerName() + "<br>" );
out.println("Server Port: " + request.getServerPort() + "<br>");
out.println("Protocol: " + request.getProtocol() + "<br>");
out.println("Server Info: " + getServletConfig().getServletContext().getServerInfo() + "<br>");
out.println("Remote Addr: " + request.getRemoteAddr() + "<br>");
out.println("Remote Host: " + request.getRemoteHost() + "<br>");
out.println("Character Encoding: " + request.getCharacterEncoding() + "<br>");
out.println("Content Length: " + request.getContentLength() + "<br>");
out.println("Content Type: "+ request.getContentType() + "<br>");
out.println("Auth Type: " + request.getAuthType() + "<br>");
out.println("HTTP Method: " + request.getMethod() + "<br>");
out.println("Path Info: " + request.getPathInfo() + "<br>");
out.println("Path Trans: " + request.getPathTranslated() + "<br>");
out.println("Query String: " + request.getQueryString() + "<br>");
out.println("Remote User: " + request.getRemoteUser() + "<br>");
out.println("Session Id: " + request.getRequestedSessionId() + "<br>");
out.println("Request URL: " + request.getRequestURL() + "<br>");
out.println("Request URI: " + request.getRequestURI() + "<br>");
out.println("Servlet Path: " + request.getServletPath() + "<br>");
out.println


Ïà¹ØÎĵµ£º

java¿ìËÙÅÅÐò

/**
 *  Õâ¶Î³ÌÐò²¢²»ÄÑ£¬Ó¦¸ÃºÜºÃ¿´¶®£¬ÎҰѹý³Ì´óÖ½²Ò»Ï£¬Ê×ÏÈÄãµÄÄÔ×ÓÀïÏȸ¡ÏÖÒ»¸öÊý×éºÍÈý¸öÖ¸Õ룬
 *  µÚÒ»¸öÖ¸Õë³ÆΪpÖ¸Õ룬ÔÚÕû¸ö¹ý³Ì½áÊø֮ǰËüÀÎÀεÄÖ¸ÏòµÚÒ»¸öÊý£¬µÚ¶þ¸öÖ¸ÕëºÍµÚÈý¸öÖ¸Õë·Ö±ðΪloÖ¸ÕëºÍhiÖ¸Õ룬
 *  ·Ö±ðÖ¸Ïò×î×ó±ßµÄÖµºÍ×îÓұߵÄÖµ¡£loÖ¸ÕëºÍhiÖ¸Õë´ÓÁ½±ßͬ ......

java²¢·¢±à³Ìʵ¼ù±Ê¼Ç

1, ±£Ö¤Ḭ̈߳²È«µÄÈýÖÖ·½·¨ :
a, ²»Òª¿çÏ̷߳ÃÎʹ²Ïí±äÁ¿
b, ʹ¹²Ïí±äÁ¿ÊÇ finalÀàÐ͵Ä
c, ½«¹²Ïí±äÁ¿µÄ²Ù×÷¼ÓÉÏͬ²½
2, Ò»¿ªÊ¼¾Í½«ÀàÉè¼Æ³ÉḬ̈߳²È«µÄ , ±ÈÔÚºóÆÚÖØÐÂÐÞ¸´Ëü ,¸üÈÝÒ× .
3, ±àд¶àÏ̳߳ÌÐò , Ê×Ïȱ£Ö¤ËüÊÇÕýÈ·µÄ , Æä´ÎÔÙ¿¼ÂÇÐÔÄÜ .
4, ÎÞ״̬»òÖ»¶Á¶ÔÏóÓÀÔ¶ÊÇḬ̈߳²È«µÄ .
5, ²»Òª½«Ò»¸ö¹²Ïí±äÁ¿Âã ......

jsp·Åµ½WEB INFϺóÒýÓò»Í¬Ä¿Â¼µÄÎļþ,ÔõôҲÕÒ²»µ½

ÎÒ°Ñindex.jspÎļþ·Åµ½WEB-INFÏ£¬ÓÖÔÚWEB-INFϽ¨Á¢Ò»¸öĿ¼jsÓÃÀ´·ÅjavascriptÎļþ£¬Ò²¾ÍÊÇ˵index.jspºÍjsĿ¼ÊÇƽ¼¶µÄ£¬µ«ÊÇÔÚindex.jspÏÂÒýÓÃjavascriptÎļþʱÔõôҲÕÒ²»µ½¡£
WEB-INF¶ÔÓÚÓû§£¨Ò²¾ÍÊÇIE£©²»¿É¼û¡£
¶Ô²ß£¬°Ñjs·Åµ½WEB-INFÍ⣬»òÕßͨ¹ýרÃŵÄjsp/servlet/actionµÈforwardµ½ÏàÓ¦µÄ×ÊÔ´¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ