mardi 8 janvier 2019

Html page doesn't work and Checkbox not selected [Java]

i've a problem with the execution of page in html written in Java.. i want to controll if checkbox is checked but my html page it's not execute.. Here the code

try
    {
        String username = null;
        String appname= null;
        String ip = null;
        String token = null;

        //connessione
        sqlite.setDbPath(dbPath);
        con = sqlite.connect();
        String query="SELECT Username, AppName, Ip, Token FROM Apps";
        ResultSet rs = con.createStatement().executeQuery(query);
        //

        while(rs.next())
        {
            username = rs.getString("Username");
            appname = rs.getString("AppName");
            ip = rs.getString("Ip");
            token = rs.getString("Token");
            list.add(username);
            list.add(appname);
            list.add(ip);
            list.add(token);
            //System.out.println(username + " "+ appname + " " + ip+ " " + token);
        }


        html="<html>" + "<body>" +"<form "+"method=get"+"action = http://localhost:8087/clayapi_dbembedded/restservices/Prova"+">" + "<table border ='1'>" +
                "<tr>" + 
                "<td>Username</td>" +
                "<td>App Name</td>" +
                "<td>Ip</td>" +
                "<td>Token</td>" +
                "<td>Autorizza</td>"+
                "</tr>";

        for(int i = 0; i<list.size(); i+=4)//ciclo for per visualizzare ('i' + 4 perchè arraylist formato da 4 colonne)
        {
            html+="<tr>";
            html+="<td>"+list.get(i).toString() +"</td>";//username
            html+="<td>"+list.get(i+1).toString() +"</td>";//appname
            html+="<td>"+list.get(i+2).toString() +"</td>";//ip
            html+="<td>"+list.get(i+3).toString() +"</td>";//token
            html+="<td>"+"<input type="+"checkbox"+">"+"</td>";//codice tasto checkbox
            html+="</tr>";//fine riga tabella
        }

        html+="</table>"+"</form>"+"</body>"+"</html>";
        html+="<br>";
        html+="<button class=\"btn btn-lg btn-primary btn-block\" type=\"submit\">Conferma</button>";
        html+="<p class=\"mt-5 mb-3 text-muted\">&copy; 2018-2019</p>";

First problem is that when i press button "Conferma" i stay on the same page and the second problem is that i don't capture value of checkbox




Aucun commentaire:

Enregistrer un commentaire