java - How to create a method to add a table -


i have question.

i have following method:

    public static object[] czydziala(string[] lista) throws ioexception {          for(int i=0 ; i<=lista.length-1;i++){             url url = new url(lista[i]);             httpurlconnection httpcon = (httpurlconnection) url.openconnection();              int len = httpcon.getcontentlength();             if (len>0){                  system.out.println(url +new string(" site work"));              }else{                 system.out.println(url +"site don't work");              }         }         return null;     } 

the argument in method list of strings.

    jframe okno = new jframe();     okno.setsize(1200, 500);     okno.setvisible(true);     okno.setdefaultcloseoperation(jframe.exit_on_close);      string [] col = {"nazwa witryny"};     string [] listawitryn = {"http://www.wp.pl",                              "http://www.onet.pl","http://mobidev.pl"};       try {         work.czydziala(listawitryn);     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     } } 

how can add table

| sites name | status |

i think wrong method created? wrong.

your code be:

public static map<string, boolean> czydziala(string[] lista) throws ioexception {     map<string, boolean> saveindblist = new hashmap<string, boolean>();     for(int i=0 ; i<=lista.length-1;i++){         url url = new url(lista[i]);         httpurlconnection httpcon = (httpurlconnection) url.openconnection();          int len = httpcon.getcontentlength();         if (len>0){              system.out.println(url +new string(" site work"));             saveindblist.put(lista[i], true);         }else{             system.out.println(url +"site don't work");             saveindblist.put(lista[i], false);          }     }     return saveindblist; } 

and

string [] col = {"nazwa witryny"};     string [] listawitryn = {"http://www.wp.pl",                              "http://www.onet.pl","http://mobidev.pl"};       try {         map<string, boolean> saveindblist = work.czydziala(listawitryn);         //your insert db call     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     } } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -