ok mi sarò spiegato male,
il codice è il seguente:
Spero possiate capire,codice:<% boolean cond = true, fine = false; String pathFile = "\\log\\ping.txt", fileStr = ""; int i; char c[]=new char[2]; (new File("\\log")).mkdir(); (new File("\\log\\ping.txt")).createNewFile(); Runtime.getRuntime().exec(new String[]{"cmd", "/C", "ping -n 2 rdccros.crosnt.com > \\log\\ping.txt"}); out.print("<script> alert('funziona'); </script>"); for (double j=0; j<2000000; j+= 0.001); out.print("<script> alert('funziona'); </script>"); FileInputStream pingTxt=new FileInputStream(pathFile); while (!fine) { i = pingTxt.read(); if (i == -1) { fine = true; } else { fileStr = fileStr + ((char) i); } } pingTxt.close(); String newstr=fileStr.substring(fileStr.length()-7,fileStr.length()-5); for (int k=0;cond&&k<2;k++){ c[k]=newstr.charAt(k); if(!(c[k]=='0'||c[k]=='1'||c[k]=='2'||c[k]=='3'||c[k]=='4'||c[k]=='5'||c[k]=='6'||c[k]=='7'||c[k]=='8'||c[k]=='9')){ cond=false; } if(c[k]==' '){ cond=true; c[k]='0'; } } newstr=""+c[0]+c[1]; if (cond){ int val=Integer.parseInt(newstr); if(val<=150){ out.write("<a>Very Good Connection: </a>"+val+"<a> ms</a>"); } else { if (val>150&&val<=250){ out.write("<a>Adequate Connection: </a>"+val+"<a> ms</a>"); } else { if (val>250&&val<=300){ out.write("<a>Slow Connection: </a>"+val+"<a> ms</a>"); } else { out.write("<a>Not Compliant Connection</a>"+val+"<a> ms</a>"); } } } } else { out.print("<a>You're NOT ABLE to connect.</a> "); out.print("<a>PLEASE, review our Site Qualification</a>"); } %>
Javascript so che non è java, ma lo implemente in out.write o out.print e dovrebbe funzionare SE leggesse quei tag uff..
RIPETO : non c'è niente che non va..E' tutto OK..
il problema sovviene nel momento in cui la pagina è caricata sul web, ovvero sembra che i tag <%..%> non vengano letti


Rispondi quotando