permaculture playing cards*
The moose likes JSP and the fly likes JSP include Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP include" Watch "JSP include" New topic
Author

JSP include

sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Hello evry one
Iam having a problem ..that when I insert a record using a jsp form Iam generating a uniwue number using oracle sequence...
after submitting i have to show him that u r unique no is this ..so I am taking user to a jsp which is selecting from the database Unique no associated with his data..
Iam using Jsp include for that..
Operation
1)user enter data in form
2)user gets a Jsp page saying u R form is inserted an du R Unique no is this..
Iam using jsp include and passing parameter to other jsp when ever a form is submitted..if I refresh that page it inserts once again..
..so I want to know that how can I provide user a unique ID as soon as he enters his form..leaving the method Iam using
same as java ranch is using when ever we insert a post it takes us to a page saying u r message has been posted..
pls check it
bye and take care
sandeep

Want to do something great will do one day
Abhinav Sharma
Greenhorn

Joined: Aug 08, 2001
Posts: 25
hi sandeep,
Whatever i have understood from your problem. I think probably you are using database oracle. But the table which you have made in database, you haven't made that field a primary key. So whenever you insert data through that jsp form inserts the value with no problem. What you should do is Make a table and make that id as unique or primary key. So whenever you will try insert a values through that jsp form. It will generate an exception and to handle that exception you have to use exception handler in your next jsp file where you are generating the record. You can get your id by this "request.getParameter("id"). Here id is the name of the input field which you have in the previous file. I hope this will help you.
bye
abhinav
[This message has been edited by Abhinav Sharma (edited November 22, 2001).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
If ur Using a Sequence to generate the Unique numbers(as u said) this is should be a problem. coz, every time just before inserting u should take the sequence no. and place in that unique field(may be the primary key as abhinav said).
Check whether u r taking the Unique no. from the Sequence every time just before the insertion.
~Kumar
------------------
Sun Certified Programmer for the Java�2 Platform
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP include