Home » Jquery » javascript – Fetch matching id from postgresql tables when i enter input

javascript – Fetch matching id from postgresql tables when i enter input

Posted by: admin February 22, 2020 Leave a comment

Questions:

My Postgresql database contains table


| Emp ID | Name | Age | Manager |
|--------|------|-----|---------|
| E001   | A    | 23  | E010    |
| E101   | B    | 19  | E001    |
| E010   | C    | 25  | E101    |
| E241   | D    | 32  | E007    |

In my web appplication jsp page contains one text box and 1 submit button
first we put manager (E010) in to text box and then click submit button and move to next jsp page which contains all data related to (E010).
But my code not working properly
Please Help

my code is given below


  Statement stmt;


{
Class.forName("org.postgresql.Driver");
  con=DriverManager.getConnection(url, username, password);
 String query = "Select manager FROM new ";
 Statement  statement = con.createStatement();
 ResultSet  rs = statement.executeQuery( query);
%>
 <%
while(rs.next())
{
String manager= rs.getString("manager");

%>

<input type="text" id="name" placeholder="Enter Your Manager Code Here......"  />
</div>
                                 </div>
                              </div>


                              <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                 <div class="row">
                                    <div class="form-group">
                                       <div class="center"><button type="submit">Submit</button></div>
                                    </div>
                                 </div>
                              </div>
                           </fieldset>
                        </form>
                     </div>
                  </div>
               </div>
How to&Answer: