Submit html form to a servlet

0

I made a connection with mysql and am making crud on own java . I want to use html and send to java to do crud . From what I read, you need a% of%. I tried to, but I could not. Here are the codes:

Connection class:

package conect_DB;  

import java.sql.DriverManager;  
import java.sql.SQLException;  

public class Conexao {  

    public static java.sql.Connection conexao;  
    private static String servidor = "jdbc:mysql://localhost:3306/ucsal";  

    public static boolean conectar() {  
    try {  

        Class driverMysql = Class.forName("com.mysql.jdbc.Driver");  

        conexao = DriverManager.getConnection(servidor, "root", "");  

        if (conexao == null) {  
        return false;  
        }  
    }  

    catch (ClassNotFoundException e) {  
        System.out.println(e.getMessage() + " on method 'conectar' error");  
    }  

    catch (SQLException e) {  
        System.out.println(e.getMessage());  
    }  

    return true;  
    }  

    public static void desconectar() {  
    try {  
        conexao.close();  
    }  

    catch (SQLException e) {  
        System.out.println(e.getMessage());  
    }  

    catch (NullPointerException e) {  
        System.out.println("method 'close()' error. Not conection opened");  
    }  
    }  

}  

servlet (obs format Servlet . Would be .java ?)

package servlets;  

public class Server {  


}  

The form tag:

<form name="form1" method="POST" action="Server">

//formulario aqui

</form>

What would this passage be like for .jsp ? I do not know how to servlet .

    
asked by anonymous 27.09.2016 / 20:58

0 answers