• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Dispatcher vs web.xml

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We are developing a small request handler, that logs request information based on its origin. Our first idea is to write a dispatcher servlet that finds out the type of request and passes that request to the specific action. This finding out is based on the url. For example:
http://www.site.com/Image.regist will be mapped to the ImageRegister object, etc.
Another way is to write servlets for each type of action. In the example we could write a ImageRegisterServlet and still invoke it the same way, by adding the servletmapping to the web.xml file.
Jakarta Struts uses a dispatcher because the actions itself are variable. We have a static number of actions, so mapping in the web.xml file is possible.
In our situation, what is preferrable: writing a dispatcher (which implements some basic business logic), or use the web.xml to map each servlet. These servlet could extend a basic servlet that does that business logic?
Thanks for replies.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's the reason for not using Struts?
It's very flexible and it's a framework which is going to save you quite some work.
I think it preferrable over both your solutions.
For example: in both your solutions you are going to spend some time programming the logic for performing the business operations either successfully or not, and passing the request to the appropriate jsp page.
Cheers,
Ruud.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic