File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes how to connect Jsp to servlet to process parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to connect Jsp to servlet to process parameters" Watch "how to connect Jsp to servlet to process parameters" New topic
Author

how to connect Jsp to servlet to process parameters

dan steve
Greenhorn

Joined: Feb 12, 2011
Posts: 7
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...
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
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



In web.xml



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.



dan steve
Greenhorn

Joined: Feb 12, 2011
Posts: 7
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......?
Ragha Aravind
Greenhorn

Joined: Aug 04, 2011
Posts: 1
Hi ,

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..

My mail id: susheelkumarbunty@gmail.com

Thanks...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to connect Jsp to servlet to process parameters