Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp update error  RSS feed

 
subhajit sengupta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sir!! Please help!!
I have a code in jsp in which I have update button with each row of sql table. But only the first row gets updated and the rest update buttons donot work. I don't know what's going wrong?
 
Tapas Chand
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is because there are multiple textboxes with same name "ENO". It should have unique values for name attribute in your case.
When request.getParameter("ENO") is called, it returns the value of the first element in the FORM with name ENO, which is the 1st row in your FORM.

NOTE: Never ever write Java code in a JSP. This is very bad practice.
 
Dave Tolls
Ranch Hand
Posts: 2809
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't be doing database work in the JSP.
The values to display should be passed in, from your servlet.

That said, what does the HTML produced by this look like?
It's the HTML in the browser that is not working, so that's where you should be looking.
 
Tim Cooke
Marshal
Posts: 3835
221
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, and welcome to the Ranch!

When posting code it is encouraged that you UseCodeTags (<- click) to make your code easy to read. I've added them for you this time, see how much better it looks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!