This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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.
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.