This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I have read HF three times, but I haven`t find an answer to this question: Why sometimes servlets have got extension .do - Even in HF, at the beginning of the book, a few of the servlets have got this extension. Now I open this site: https://www.suntrainingcatalogue.com/eduserv/chooseLocale.do and here is also this extension. So why .do ? :
Most of the time .do indicates that the Struts framework was used. It makes it easy to map all *.do requests to the Struts controller servlet. You wouldn't want to map *.jsp to the Struts servlet, because then you couldn't have any Struts-free .jsp pages; so something else is used.
Another reason might be backwards compatibility. Maybe a site was formerly implemented in Cold Fusion, resulting in lots of *.cf URLs that are all over the place. Instead of breaking all those URLs, you simply map *.cf to the JspServlet (in addition to *.jsp), and -presto!- all your *.cf pages can now contain JSP code instead of Cold Fusion code.
let's say you have a web app, and one part of it is public to the whole world, the other part is only for registered users. ..
you could declare a security constraint that acts upon all urls that are mapped to /rootPath/secure
instad though, you could achieve the same goal by using a predefined extension for the secured part of you web app, something like <url-pattern>*.secure</url-pattern>
now, as for .do, do is a common extension for the Struts web framework.
The struts framework processes all it's request thru something called a front controller, to centralize navigation.
how it achieves this is by a simple filter that is invoked for every url that ends in .do
so in general, it is a common way to identifiy or dedicate or certain area or requirement in your web app.
as an example, imagine you offer a download service that offers short text documents for download.
You want to offer the text docs for direct download, but also in zip format,
so what you would do is create a filter that maps to urls that end in .zip which then wraps up the response into a ZipOutputStream.
this also encapsulates other code, since all you do is create a filter without touching further business classes
JDBCSupport - An easy to use, light-weight JDBC framework -