File jsp does not open in the browser, but if it does in eclipse

0

As I mentioned in the question. a jsp file runs in eclipse but when running it in a browser it does not open and it shows all the code.

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"%>
   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                                                                                                                                                                   "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 < head>
   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <title>Insert title here</title>
 <%@ page import="java.sql.*"%>
 </head>
<body>

  <%
  String nombre=request.getParameter("nombre");
  String apellido=request.getParameter("apellido");
  String usuario=request.getParameter("usuario");
  String contra=request.getParameter("contra");
  String pais=request.getParameter("pais");
  String tecno=request.getParameter("tecnologias");          
  Class.forName("com.mysql.jdbc.Driver");
  try{
        Connection conexion=DriverManager.getConnection("jdbc:mysql://192.145.239.205:3306/juliogod_datos","juliogod_juliogodoy","matematica12");
   out.print("conecto base de datos");
     Statement enunciado=conexion.createStatement();
         String instruccionSql="INSERT INTO datos (nombre, apellido, usuario, 
        contraseña, pais, tecnologia) VALUES ('"+nombre+"','"+apellido+"','"+usuario+"','"+contra+"','"+pais+"','"+tecno+"')";
        enunciado.executeUpdate(instruccionSql);
        conexion.close();
        out.println("Registrado con exito");}catch(Exception e){
       out.println(e);

        }

     %>
     </body>
     </html>
    
asked by Julio enrique godoy muñoz 02.03.2018 в 15:25
source

0 answers