请教jsp页面限制ip段访问的问题 有一个jsp页面,我想只让 192.168.96.0---192.168.127.255 这个ip段能访问,请问具体代码该怎么写,因为没学过jsp,所以请大家帮帮忙, 据说可以用 “request.getRemoteAddr();”来获取ip,进行限制,但具体代码我不太会,麻烦大家帮我看看,谢谢了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://myhongkongzhen.javaeye.com/blog/380911 可以看看JSPGenCMS的IP限制解决方案....下载个研究下 String ip=request.getRemoteAddr();//客户端IP int k_ip=1; if(k_ip==0){ String[] str_ip=new String[]{}; str_ip=ip.split("\\."); System.out.println(str_ip[0]); if((str_ip[0].equals("10")&&str_ip[1].equals("32"))|| (str_ip[0].equals("127")&&str_ip[1].equals("0")&&str_ip[2].equals("0")) ){ }else{ %> <script type="text/javascript"> alert("can't enter!"); window.location.href="../../index.faces"; </script> <% } }自己写个循环 自己仿照吧 文件下载问题 这个500错误怎么改!求大家帮帮忙!很急 !~~~在线等!!!!直到解决!!!! 如何使用rss进行文件数据的导入(急!) radio校验问题 100分急求 jsp中默认页的位置 为什么struts标签不能用在html文件里面? [好心人指导一下]tomcat的介绍有吗?我想系统的了解一下啊 弹出层页面的问题 简单问题!关于ResultSet JSP中显示分页的问题,多谢! 服务器向客服端发送命令,以控制客户端 prepareStatement mysql 问题
int k_ip=1;
if(k_ip==0){
String[] str_ip=new String[]{};
str_ip=ip.split("\\.");
System.out.println(str_ip[0]);
if((str_ip[0].equals("10")&&str_ip[1].equals("32"))|| (str_ip[0].equals("127")&&str_ip[1].equals("0")&&str_ip[2].equals("0")) ){
}else{
%>
<script type="text/javascript">
alert("can't enter!");
window.location.href="../../index.faces";
</script>
<%
}
}自己写个循环 自己仿照吧