Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Examples of using servlets to search and display the details from database.

 
Loh Peggie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys do you have any great examples of link that enables me to search the productid from database using servlets and jsp and then display all the information from the database, so that if there is any wrong info I can edit from it and display it again



Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fastest way of getting all that up and running in one go (assuming that you don't yet have any of pieces involved) is probably to use Grails. If you're asking about any specific piece of it, tell us which one that is.
 
Loh Peggie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see i see. Thanks

Oh I mean that for example, I create a servlet and jsp to search for productid from the database and when I search for productid:1101. All information regarding on 1101 will display.

Thanks
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will make this very simple. Using teh very common MVC pattern, you will have the user enter the item to seach for in the browser and hit submit, That will go to a servlet (controller) get that will get that and call the backend businnes logic that will search the database, possible using a DAO, the results will be passed back to teh controller preferably via a business object (also called a data transfer object). The controller will add object holding the results to a certain scope (session, request, application) as an attribute, where the jSP can find it and then forward the request to the JSP. The JSP will then get it and process it so that the browser can display it. You will have some tags in your JSP to help doing this.

You may want to search for MVC pattern. I am sur eyou can find example of something similar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic