title: how insert data into database from table in jsp
body: <p>Why not data store into database in jsp. find error in the following  the code. I want to fetch data from form fields and get it from jsp page and store into database.</p>
  
  <p>database name=test table name=info columns name=first_name,last_name</p>
  
  <pre><code>&lt;%@page import="java.io.*,java.util.*,java.sql.*"  %&gt; 
  &lt;%@page import="javax.servlet.*,javax.servlet.http.*" %&gt;
  &lt;%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %&gt;
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;connection with database&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          String f_name = request.getParameter("f");
         String l_name = request.getParameter("l");
          &lt;sql:setDataSource var="sqldata" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/test" user="root" password="" /&gt;
          &lt;sql:update dataSource="${sqldata}" var="result1" &gt;
              INSERT INTO info(first_name,last_name)VALUES('f_name','l_name');
          &lt;/sql:update&gt;--%&gt;
  
  
              &lt;input type="text" name="f" /&gt;&lt;br /&gt;
               &lt;input type="text" name="l" /&gt;&lt;br /&gt;
               &lt;input type='submit' /&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>