• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to prompt if there is no match in database using servlet?

 
lisy jessica
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi am trying to compare two columns(serial_no) in two different tables Table1 and Table2, If there is a match I want to update 10 variables to table1 if no match then simply copy the serial_no to table1, I wrote a join for the first part now I don;t have any idea about how to copy if there is no match....Please can anyone look into my code and help me out....here is my code

StatusServlet



 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


You have SQL / Business logic and presentation code all in one servlet ? I would advise the following

1. Treat the servlet as a controller for the flow of code.
2. Create new service classes that will handle your business logic. Call them from the controller.
3. Move the data access logic to DAOs
4. Move the presentation logic to JSPs

I don;t have any idea about how to copy if there is no match


I am not quite sure what that means
 
lisy jessica
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am comparing the columns in two different tables Table1 and Table2 if there is a match then update, otherwise copy the Serial_No to Table1 this is what I mean.....

Thanks for the reply..Which framework I need to use struts or Spring?.

 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
otherwise copy the Serial_No to Table1 this is what I mean.....


This involves the use of a insert or update statement into the DB

I need to use struts or Spring?.


It depends on what you want. You can even get off not using a framework at all. And by that I mean you can use the Servlet / JSP framework
 
lisy jessica
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok will try this. Thanks for the help.
 
Sudheer Bhat
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are making use of Oracle DB, check the MERGE statement for your case.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic