title: How do I execute an SQL SELECT query in JSP?
body: <p>I want to execute an SQL query in JSP. The display must be in JSP code, not in java.</p>
  
  <p>I cannot introduce JSP code in a java page.</p>
  
  <pre><code>package tn.com.tradenet.utilisateur;
  
  import java.io.IOException;
  import java.io.PrintWriter;
  import java.sql.Connection;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  
  
  import javax.servlet.RequestDispatcher;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpSession;
  
  
  public class Modification extends HttpServlet
  {
  public void doPost()
  {
  try
  {
  
  String id ="1"; //request.getParameter("userName");
  String nom ="mecchlaoui"; //request.getParameter("userName");
  String prenom ="fawzia"; //request.getParameter("userName");
  String email ="hotmail"; //request.getParameter("password");
  String profil ="fawzia"; //request.getParameter("password");
  String login ="fawzia"; //request.getParameter("password");
  String pass ="1258"; //request.getParameter("password");
  
  ConnectionBD mod = new ConnectionBD();
  //String sql="SELECT id FROM utilisateur";
  //ResultSet res=mod.execMonSQl(sql);
  
  
  //while (res.next())
  //{
  //id = res.getString(1);
  
  //}
  
  mod.execMonUpdate("UPDATE utilisateur SET nom='"+nom+"',prenom='"+prenom+"', email='"+email+"', profil='"+profil+"',login='"+login+"',pass='"+pass+"' WHERE 'id'='"+id+"'");
  System.out.println("element ajoutté");}
  
  catch(SQLException s)
  {
  System.out.println("erreur" +s);
  }
  }
  
  public static void main(String[] args) {
  
  Modification mdf =new Modification();
  
  mdf.doPost();
  
  
  }
  
  
  } 
  </code></pre>