Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

for loop with insertion query  RSS feed

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the html page based on for loop we are dropping rows based on number...there its showing all rows step by step .... that's fine..But When i am  writing  insertion query in process page i am getting error only the last row value what i have entered is going inside rest all rows values are not going Any one Please suggest me to how to solve this issue
 
Rancher
Posts: 1919
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#1.  First of all you should not write java code inside jsp.  It's an very old approach.  JSP should be used for view purpose.  You should ideally use servlet for this.

#2   Without looking at part of your code, it's bit difficult to figure what the issue is.
 
sushma swaraj
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator





Please see the above Code
 
sushma swaraj
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Swastik Dey
Rancher
Posts: 1919
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your looking construct looks bit confusing.



What output do you expect?
 
sushma swaraj
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actuallyy... The first four input fields are same ..after that it will show drop downmenu based on drop down menu we will select number ..based on that number it will show all rows..now i want to insert those all in one table with different postcodes
 
sushma swaraj
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check images
adv-.JPG
[Thumbnail for adv-.JPG]
advselection.JPG
[Thumbnail for advselection.JPG]
 
Swastik Dey
Rancher
Posts: 1919
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per this you should retrieve the adv number, start dt, last dt out side loop, and other fields inside loop, and your insertion routine should go inside that loop.
 
Swastik Dey
Rancher
Posts: 1919
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should likely to be somewhat like this

 
sushma swaraj
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Here I need to write three insertion queries right
 
sushma swaraj
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here we are uploading document so we need to use   (  multipart/form-data  ) in front page .. So i think request.getParameter() will not work
 
Rancher
Posts: 3794
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really, do not do this in a JSP page.
That's a mass of code that you will find almost impossible to debug properly.

Move it out into a service that a servlet can call.
The servlet then gathers the data that the JSP will need and then forward to the JSP page.
 
sushma swaraj
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any way thank you  it worked..Thanks a alot
 
Swastik Dey
Rancher
Posts: 1919
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds good.  However as told in few previous posts, you should switch to servlet.
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!