Examples of using servlets to search and display the details from database.
Joined: Jul 09, 2009
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
Joined: Mar 22, 2005
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.
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.
Joined: Nov 06, 2000
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.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley