File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing Control from JSP to Servlet

 
Venny Ra
Greenhorn
Posts: 15
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am working on this project and facing some issues. Am a newbie in web development and need your assitance.

Here is my problem: I created a JSP page with a form and input fields. Once the form is submitted, I want the data to be processed by servlet which further invokes a DAO class that interacts with database and generates the response based on what user entered. Little diagram will probably explain it well.

login.jsp ---------> loginServlet --------> loginDAO (check if the username is already in DB) ------------> success.jsp (if username exists) error (otherwise).

I am putting the location for login servlet in form action attribute but it cant find it. I have tried all means.

I can put the code here if you need for reference. Eagerly waiting for the reply.

Thanks
Venny
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually a RequestDispatcher is used to forward the request from a servlet to a JSP.

You might want to read through this article.
 
Venny Ra
Greenhorn
Posts: 15
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Usually a RequestDispatcher is used to forward the request from a servlet to a JSP.

You might want to read through this article.


Hi, thanks for the reply. I am able to pass the control from servlet to jsp but my problem is coming to servlet from jsp. like say I have a form with values taken from user, how do I pass the control to servlet to process the form ?


Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The action attribute of the form should address the servlet.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic