• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to retrieve data from html table in servlet and insert it into database

 
Shobham Kumar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to retrieve the data from this table given below and insert that data in the database in the next servlet



Untitled.png
[Thumbnail for Untitled.png]
Table
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

First and foremost you must make sure that the HTML you are generating is valid. It isn't. There are many mistakes.

This is much easier when you do not use strings in a servlet to generate HTML, but use a JSP. That's exactly what JSP is for. Please read this article to understand how to structure modern Java web applications.

You can also read this article to understand what JSP is all about.

Once your HTML is under control, you;d make sure that the form has a submit button. When clicked, the values in the input elements will be submitted to the servlet associated with the form though the action url.

The fact that the input elements are arranged in an HTML table is completely irrelevant.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also be sure to use Java naming conventions. "crew" is not a suitable name for a class. It should start with an uppercase character, and be descriptive. "crew" fails both tests.

Also, servlets should not have a constructor. Remove it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!