• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP form Not working

 
Brooke Maddox
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page that has a table that list each movie in my database. The user should be able to choose one movie from the list for purchase. I am using a form inside my table that has a hidden input and uses the Movie ID number as a parameter. The Servlet takes the parameter and sets it to the session, and sends the response to another JSP page. Everything works fine, unless I choose the first item in the table. So for instance, I have 5 movies in my database, if I choose to purchase the first one my cart.jsp page is empty but if I choose any of the other 4 the cart.jsp page displays the movie ID and Movie title.
Here is my code




 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//Change paramters to correct types
int id = Integer.parseInt(ID);



If this was my problem I would be:
1. examining the html on the browser with view source
2. logging that ID value and probably I would be catching NumberFormatExceptions.

Bill
 
Brooke Maddox
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another rookie mistake on my part I had an extra form above my table.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic