• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP program error: "java.sql.SQLException: Invalid column Index"

 
Nathan Lad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to create a program that creates a form for user input and displays the information in 3 separate SQL tables.

Here are the requirements of the program.
Implement a user interface (very basic) for your pilot project. Your Pilot Project will need to implement a minimum of the following interfaces into the database:
A menu page that links to all the pages in your project.
A page to create all required tables and insert the initial records needed for the application to function.
A page to drop all tables used in the project.
A form, that when submitted, inserts data into a database table(s).
A page the displays the data in the table(s) updated for verification.
The pages for this project should not be plain white pages.  Add a few images, styles sheets, etc. that enhance the pages' appearance.

Here is all the code I have so far. Please help!



INDEX.HTML


SAVETAGHANDLER.JAVA



SAVETAGHANDLER.LTD

WEB.XML


NAME.JAVA
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathan,
Welcome to CodeRanch!

I edited your post to fix the code tags. Note they have to be around the code not before and after. Basically, select the code you want in a code tag and then press the code button.

Anyway, your problem lies here:

You call setString(), but there are no ? (binding variables) in the prepared statements.

Also, i strongly recommend specifying the columns rather than using select *.
 
Nathan Lad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jeanne, but I'm a little lost still. How would I go about setting binding variables in the prepared statements?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like this:


Once you get it working for one row, you can add a loop to do this for each user.
 
Nathan Lad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried the above and it still isn't working. Could you please edit my code with any fixes? To be honest I'm not good with JSP or JAVA, I do like straight SQL but adding the other languages confuses me. I need Student_ID and Class_ID from their corresponding table to pull into StudentClasses table. I keep trying to edit my code to get it to work, but no luck yet.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathan Lad wrote:I've tried the above and it still isn't working. Could you please edit my code with any fixes? To be honest I'm not good with JSP or JAVA, I do like straight SQL but adding the other languages confuses me. I need Student_ID and Class_ID from their corresponding table to pull into StudentClasses table. I keep trying to edit my code to get it to work, but no luck yet.

No. If I edit your code, you don't learn how to do it. I'm not the one with a homework assignment.

When something doesn't work, start removing code until you have the simplest example that shows the problem. Then show that and what error message you get.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic