please can somebody show me an in-depth example of how to link a jsp to a servlet for processing..what I mean is,... I have this application in three tier, the front end being jsp forwards parameters to servlets for database access through the Dao..I first thought I got the calling of methods wrong from the Dao but then realized the servlets were not in any way connected to the jsps...I tried a couple of tricks like using ~/..servletName when passing the processing to the servlet through the <form action = ""> tag...no jsp in my application is connected to any servlet...its really a shame cos I had no problem with writing every other components but to connect....thank you in advance for your help...
You tie them with the "action" attribute of a form.
The URL of the form action should map to a servlet.
So in your web.xml you have to set up a bunch of servlets and servlet mappings.
So on your jsp
Submitting the form goes to the /myServlet url
That maps to MyCoolServlet and should then invoke the doGet/doPost method of com.mypackage.MyCoolServlet.
And thats about all there is to it.
Joined: Feb 12, 2011
well yeah...thanks for helping....I have completed writting my dao and can insert intto database but when using arrayList to retrieve values from the database, I dont get any display and any further attempts to make it work has brought in errors....can you please show me how to implement an arrayList on a method in the dao and call it from a servlet......?
I need the code and the procedure how you did the jsp user interface and linked it to servlet, then the dao to the database. dan steve has done the three tier work......please please please help me. I need it very urgently........Please dan steve..... if you happen to see this request give me your email id or any contact number.....please. I need it very urgently.... or somebody who helped the person when there was an issue, please help me with the complete code and details if possible. Please help me frnds..