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

JSP´Ó·þÎñÆ÷»ñÈ¡¿Í»§¶Ë·ÃÎÊIP


ÔںܶàÓ¦ÓÃ϶¼¿ÉÄÜÓÐÐèÒª½«Óû§µÄÕæʵIP¼Ç¼ÏÂÀ´£¬Õâʱ¾ÍÒª»ñµÃÓû§µÄÕæʵIPµØÖ·£¬ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£º request.getRemoteAddr()£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache,SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
¡¡¡¡Õâ¶Îʱ¼äÔÚ×öIPͳ¼ÆµÄ³ÌÐòÉè¼Æ£¬ÓÉÓÚ·þÎñÆ÷×÷Á˼¯Èº£¬Ê¹ÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110:2046/µÄ URL·´Ïò´úÀíΪhttp://www.xxx.com/µÄURLʱ£¬ÓÃrequest.getRemoteAddr()·½·¨»ñÈ¡µÄIPµØÖ·ÊÇ£º 127.0.0.1¡¡»ò¡¡192.168.1.110£¬¶ø²¢²»ÊÇ¿Í»§¶ËµÄÕæʵ£É£Ð¡£ÕâÊÇʲôԭÒòÄØ£¿
¡¡¡¡ÕâÊÇ·´Ïò´úÀíµÄÔ­Òò¡£¾­¹ý´úÀíÒÔºó£¬ÓÉÓÚÔÚ¿Í»§¶ËºÍ·þÎñÖ®¼äÔö¼ÓÁËÖмä²ã£¬Òò´Ë·þÎñÆ÷ÎÞ·¨Ö±½ÓÄõ½¿Í»§¶ËµÄIP£¬·þÎñÆ÷¶ËÓ¦ÓÃÒ²ÎÞ·¨Ö±½Óͨ¹ýת·¢ÇëÇóµÄµØÖ··µ»Ø¸ø¿Í»§¶Ë¡£µ«ÊÇÔÚת·¢ÇëÇóµÄHTTPÍ·ÐÅÏ¢ÖУ¬Ôö¼ÓÁËX£­FORWARDED£­FORÐÅÏ¢¡£ÓÃÒÔ¸ú×ÙÔ­ÓеĿͻ§¶ËIPµØÖ·ºÍÔ­À´¿Í»§¶ËÇëÇóµÄ·þÎñÆ÷µØÖ·¡£µ±ÎÒÃÇ·ÃÎÊhttp://www.xxx.com/index.jsp/ʱ£¬Æäʵ²¢²»ÊÇÎÒÃÇä¯ÀÀÆ÷ÕæÕý·ÃÎʵ½ÁË·þÎñÆ÷É쵀 index.jspÎļþ£¬¶øÊÇÏÈÓÉ´úÀí·þÎñÆ÷È¥·ÃÎÊhttp://192.168.1.110:2046/index.jsp£¬´úÀí·þÎñÆ÷ÔÙ½«·ÃÎʵ½µÄ½á¹û·µ»Ø¸øÎÒÃǵÄä¯ÀÀÆ÷£¬ÒòΪÊÇ´úÀí·þÎñÆ÷È¥·ÃÎÊindex.jspµÄ£¬ËùÒÔindex.jspÖÐͨ¹ýrequest.getRemoteAddr()µÄ·½·¨»ñÈ¡µÄIPʵ¼ÊÉÏÊÇ´úÀí·þÎñÆ÷µÄµØÖ·£¬²¢²»ÊÇ¿Í»§¶ËµÄIPµØÖ·¡£
¡¡¡¡ÓÚÊǿɵóö»ñµÃ¿Í»§¶ËÕæʵIPµØÖ·µÄ·½·¨Ò»£º
Java´úÂë
public String getIpAddr(HttpServletRequest request) {  
      String ip = request.getHeader("x-forwarded-for");  
      if(ip == null || ip.length() == 0) {  
            ip = request.getRemoteAddr();  
        }  
        return ip;  
    } 
public String getIpAddr(HttpServletRequest request) {
      String ip = request.getHeader("x-forwarded-for");
      if(ip == null || ip.length() == 0) {
            ip = reques


Ïà¹ØÎĵµ£º

Jsp±à³Ì

 JAVA×ÛºÏÃæÊÔÌ⣺ҳÃæµÄץȡ¡¢½âÎö¡¢±£´æÊý¾Ý¿âºÍÉú³ÉHTMLµÄÒ³Ãæչʾ ÊÕ²Ø
´ÎÀý×Ó¿ÉÒÔÓÃÀ´Ñ§Ï°ÍøÂç±à³Ì£¬ÕýÔò±í´ïʽµÄʹÓ㬷ºÐÍ£¬Êý¾Ý¿âµÄ»ù±¾²Ù×÷µÈJAVA֪ʶ
ÎÊÌâÈçÏ£ºÀ´Ô´ÓÚÂÛ̳
http://topic.csdn.net/u/20090616/13/59aa4e2d-3752-45df-9c1b-c65c46c3e4d7.html
дһ¸öjspÒ³Ã棬·ÃÎÊʱÏÔʾ´ÓÏÂÃæµÄÒ³ÃæÌ ......

¹ØÓÚjspÂÒÂëÎÊÌâµÄ½â¾ö°ì·¨

Ò»£¬´¿´âµÄjspÒ³ÃæÖÐÎÄÂÒÂë
   Ô­Òò£º¶Ôjsp´úÂëµÄ±àд£¬Ä¬ÈϵÄ×Ö·û¼¯Ê“ISO-8859-1”£¬Èç¹û´úÂëÖдæÔÚÖÐÎÄ£¬Ôò»á³öÏÖÂÒÂ룡
   ½â¾ö°ì·¨£ºÔÚpageÖмÓÉÏcontentType="text/html;charset=gb2312"£¬²ÉÓùú±êÀ´·­ÒëÒ³ÃæÖеĴúÂ룡
¶þ£¬post·½Ê½Ìá½»±íµ¥³öÏÖÂÒÂë
   Ô­Òò£º ......

JSP×Ô¶¨Òå±êÇ©(Tag)

ʵÏÖJSP×Ô¶¨Òå±êÇ©µÄÒ»ÖÖ·½·¨£º
1.дһ¸öÀà¼Ì³ÐTagSupport»òÆäËûTagµÄʵÏÖÀà¡£
public class AllTag extends TagSupport {

@Override
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
try {
out.append("Hello World.");
} catch (IOException e) {
e.pri ......

jspÖÐʹÓÃEXCEL×é¼þ½«±í¸ñµ¼³öΪEXCELÎļþ

´ËÖÖ·½·¨Ê¹ÓÃexcelµÄ×é¼þ£¬ÒªÇó¿Í»§¶Ë±ØÐë×°ÓÐexcel³ÌÐò¡£·½·¨Êǽ«±í¸ñÖеÄÿ¸ötd±êÇ©µÄÄÚÈÝÈ¡³ö£¬×÷ΪexcelÎļþÖÐÒ»¸öµ¥Ôª¸ñµÄÄÚÈÝ¡£
1¡¢ÔÚÍøÒ³ÖÐÌí¼Ójava½Å±¾
function AutomateExcel(tableid,unusecolumn)
{
 // »ñÈ¡excel×é¼þ
 var oXL = new ActiveXObject("Excel.Application");
 
 // ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ