Dear All, Hey, I have seen the remarks on O' reily's 'Java Servlet Programming'. Some people are of the opinion that the book talks about servlet chaining, which is supported by JWS (server, the author talks about), but is not supported by Apache+Tomcat. Apart from that, they are also of the opinion that servlet chaining is not a good programming practice. Can anybody shed some light here?? Bye, Tualha Khan
Servlet Chaining is a technique where you configure a servlet container to pass the output of one servlet to the input of another (and so on) before returning it to the client. It has several problems. The first problem is its non-standard implementation. Only a few servlet containers support it, it has never been part of the official servlet API, and cannot be configured using web.xml etc. like other servlet container configurations. The second problem is that servlets are not essentially chainable. The input to a servlet (a HTTP request and maybe some parameters or POST data) is quite different to the output from a servlet (some formatted HTML ready for display by a browser). So if you are building a system which uses servlet chaining, the servlets have to somehow "know" that they are being used in a chain, and either get their input differently, or produce their output differently, so that communication between the servlets in the chain can make some sort of sense. When the Servlet 2.3 API is finalized, and the containers which are currently tracking it are released as fully-supporting versions, this whole problem should go away. Version 2.3 of the servlet API brings in the concept of "filters" to do the sort of jobs people want to use servlet chaining for, but as they are not the same as servlets, they can have compatible inputs and outputs, and be plugged together in arbitrary, creative, ways just by reconfiguring a web-application. You can already try this with the very latest versions of Tomcat, Resin and so on, which have a good stab at implementing the current draft 2.3 API.