天天看點

JavaScript往Jsp裡面傳值

db.jsp為要傳值的Jsp名;

request.getRemoteAddr();為擷取目前頁面的IP值;

寫在Js裡的部分:

location.href="db.jsp?ip=" target="_blank" rel="external nofollow" +request.getRemoteAddr();
           

寫在db.jsp裡面的部分:

String ip=<span style="font-family: Arial, Helvetica, sans-serif;">request.getParameter("ip");</span><span style="font-family: Arial, Helvetica, sans-serif;">	</span>