In a simple servlet program I am creating profiles for different persons registering with the application.The related "registration" table has a "USERID" column where the users' unique "USERID" will be stored. Now I have another table named "MEAL" which has the same column "USERID" which is primary key to "registration" table. When an user will select a meal to be taken from meal selection page corresponding meal data are saved to "MEAL" table.Now I wish the corresponding USERID to be automatically stored in the "USERID" column of the "MEAL" table. So how can I achieve this functionality?Please help me on this!!
how the user is taking meals? how you are identifying which user is taking meals? if you now that user, who is taking meals you can get that "USERID" value(because it is a primary key) and insert it in the meals table.