• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP form Not working

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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




 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another rookie mistake on my part I had an extra form above my table.
 
reply
    Bookmark Topic Watch Topic
  • New Topic