File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing data to database

 
Mayura Hayat
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
i have a jsp page which takes in the details from the user like the name, age, gender,etc.
how do i insert data for more then 1 user into the database at the same time i.e just by a single click.???
i'm not using servlet.

please please help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mayura Hayat wrote:how do i insert data for more then 1 user into the database at the same time i.e just by a single click.?

What do you mean by more than one user? How can more than one user be submitting data?

i'm not using servlet.

Why not? A servlet should be used to process the data.
 
Mayura Hayat
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think i was not quiet clear when i posted the question.
well i'm doing a project on flight reservation. what i want to ask was that when the user login he is able to book ticket for more den 1 person.
so i have provided textboxes to add the relevant info. about more people i.e if he is to book two tickets he needs to enter the data i.e name age gender for two people.

At Backend(oracle 10g XE) i want to add this data to the database.. but unable to do it.

how do i acheive this on the single submit.???

please help..
Thank you in Advance.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "unable to do it" mean, exactly? What does your code currently do? And as Bear said, a servlet is the way to handle a form submission like this.
 
Mayura Hayat
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unable to do it means that i'm unable to add the data to database...
my code accepts the data or rather insert the data just for one person into the database ... but not for more then one person.
Yes taking his advice i'm using scriplets..

i'm new to jsp.

Any help will be useful. please.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think we'll be able to give any more advice without seeing the relevant code excerpts (that get the data from the form submission and store it to the DB).
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mayura Hayat wrote:
Yes taking his advice i'm using scriplets..

Who said anything about scriptlets? Scriptlets should not be used!

You should be submitting the form to a servlet.
 
Amit Ghorpade
Bartender
Posts: 2851
10
Fedora Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mayura Hayat wrote:insert the data just for one person into the database ... but not for more then one person.

If you are able to successfully insert one record, then one possible deduction I can make is that you are using request.getParameter() for reading multiple values.
 
Mayura Hayat
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amit you are right.
m i doing it the wrong way.? can you tell me the correct way to do it?
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you show us your code snippet.
 
Mayura Hayat
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
flightbook.jsp:


i'm new to jsp any suggestion will be taken.
Thank You in advance.
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Is it not leading to ArrayIndexOutOfBoundsException?

Should it not be?

 
Mayura Hayat
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thank you all especially swastik... it worked.. i was struggling with this thing for a long time.
data successfully entered into the database ... :) ohhh!! that's Christmas!!

Thank you once again all.
and i'm sorry for the inconvenience caused.


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic