Nicely put Ben. If you are just using the servlet to render a view for a jsp, then go ahead and use a filter instead if that fits your fancy. But to say that a Filter can do anything a Servlet can is a bit misguided, and probably incorrect.Use a hammer for pounding in nails, and a wrench for turning bolts.
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Originally posted by Paul Bourdeaux:
It may be possible, but using a JSP to preform logic, database functions, etc, is considered bad practice. Not to mention what a nightmare it would be for anyone that needed to maintain your code later on.
Originally posted by Ben Souther:
Again, as a controller in an MVC framework, a filter may be a suitable replacement for a servlet. I certainly wouldn't want to stream binary files or do printWriter operations from one though.
Originally posted by Ben Souther:
Again, as a controller in an MVC framework, a filter may be a suitable replacement for a servlet. I certainly wouldn't want to stream binary files or do printWriter operations from one though.
Originally posted by Ben Souther:
You've got the reqeust and response objects so I don't see why not.
You could always test this. Try it.