This week's giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Production-Ready Serverless (Operational Best Practices) and have Yan Cui on-line!
See this thread for details.
Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

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: 1931
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: 1931
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: 1931
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: 1931
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: 3983
47
  • 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: 1931
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.
 
What's that smell? Hey, sniff this tiny ad:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!