jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes How to write ActionServlet which should act like a controller? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to write ActionServlet which should act like a controller?" Watch "How to write ActionServlet which should act like a controller?" New topic
Author

How to write ActionServlet which should act like a controller?

Sandhya Deekonda
Ranch Hand

Joined: Dec 18, 2006
Posts: 34
Hi All,
I have a web application in which i've a jsp like One.jsp.In that jsp i've a form,when ui submit it should go to another jsp.But in the action field of the first jsp,I shouldn't mention the second jsp name.I should mention some thing like "welcome".When i submit the form, it should go to a servlet which sends the form to the second jsp,that means the servlet acts like a controller which sends the request to the corresponding jsp.How can i do that? Can anyone help me??
Thanks,
Sandhya.
[ January 17, 2007: Message edited by: Bear Bibeault ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You should read up on request dispatchers:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/RequestDispatcher.html

Also, in my signature, there is a link to the servlet spec, in it there is a section on servlet-mappings.

What you want to do can be done with a controller or it can be done by giving your JSP a servlet entry and a servlet-mapping with the url-pattern of your choice.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sandhya Deekonda
Ranch Hand

Joined: Dec 18, 2006
Posts: 34
In my first jsp,when form is submitted the server checks for the requested url in the web.xml .If it finds that url it goes to that particular jsp or servlet.This shouldn't happen.It should go to some other servlet,that servlet should point to some other configuratopn file like config.xml.From there it should go to the requested servlet.How can i do that?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Why don't you show us what you've got so far?
Have you read the links that I posted?
Sandhya Deekonda
Ranch Hand

Joined: Dec 18, 2006
Posts: 34
Ya I went through the links which you posted.
 
wood burning stoves
 
subject: How to write ActionServlet which should act like a controller?
 
Similar Threads
jsp page submit datas back to itself
I need help with this situation regarding form post parameters
MVC Architecture for Web
very common form functionality
Navigating to another page...